Skip to content

Commit

Permalink
Better subgraph errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jgautheron committed Oct 24, 2023
1 parent 16b38c5 commit a846a1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion crates/handler/src/service_route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,13 @@ impl ServiceRouteTable {
.headers(header_map.cloned().unwrap_or_default())
.json(&request)
.send()
.and_then(|res| async move { res.error_for_status() })
.await?;

if !raw_resp.status().is_success() {
let body = raw_resp.text().await?;
return Err(anyhow::anyhow!("received non-2xx response from service \"{}\", body: \"{}\"", service, body));
}

let mut headers: HashMap<String, Vec<String>> = HashMap::new();

for (key, val) in raw_resp.headers().iter() {
Expand Down
4 changes: 2 additions & 2 deletions crates/handler/src/shared_route_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ impl SharedRouteTable {
extensions: Default::default(),
headers: Default::default(),
})
.unwrap(),
.unwrap_or_default(),
)
.unwrap();
.unwrap_or_default();
}
};

Expand Down

0 comments on commit a846a1a

Please sign in to comment.