Skip to content

Commit

Permalink
fix: handle network subgraph query errors better
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis committed Sep 20, 2023
1 parent 95ba473 commit b5bb060
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions service/src/server/routes/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,10 @@ pub async fn network_queries(
.expect("Failed to execute free network subgraph query");

if response.status().is_success() {
(
StatusCode::OK,
Json(
response
.json::<Value>()
.await
// FIXME: Don't use expect here
.expect("Failed to parse network subgraph query result"),
),
)
.into_response()
match response.json::<Value>().await {
Ok(value) => (StatusCode::OK, Json(value)).into_response(),
Err(e) => bad_request_response(&e.to_string()),
}
} else {
bad_request_response("Bad response from Graph node")
}
Expand Down

0 comments on commit b5bb060

Please sign in to comment.