Skip to content

Commit 1e52f82

Browse files
authored
fix: add more information about failing subgraph query (#436)
1 parent a3cc07e commit 1e52f82

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

common/src/subgraph_client/client.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,15 @@ impl DeploymentClient {
184184
// TODO handle partial responses
185185
Ok(match (response.data, response.errors) {
186186
(Some(data), None) => Ok(data),
187-
(_, Some(errors)) => Err(anyhow!("{errors:?}")),
188-
(_, _) => Err(anyhow!("Invalid error")),
187+
(None, Some(errors)) => Err(anyhow!("{errors:?}")),
188+
(Some(_data), Some(err)) => Err(anyhow!("Unsupported partial results. Error: {err:?}")),
189+
(None, None) => {
190+
let body = serde_json::to_string(&body).unwrap_or_default();
191+
Err(anyhow!(
192+
"No data or error returned for query: {body}. Endpoint: {}",
193+
self.query_url.as_str()
194+
))
195+
}
189196
})
190197
}
191198

0 commit comments

Comments
 (0)