return more useful messages when a server function errors

This commit is contained in:
Evan Almloff committed 2023-08-07 11:09:51 -07:00
1 parent a025617db3
commit 65102b70c7
2 files changed
+12 -4

No files matched your search

@@ -263,8 +263,8 @@ where
let res = service.run(req);
match res.await {
Ok(res) => Ok::<_, std::convert::Infallible>(res.map(|b| b.into())),
Err(_e) => {
let mut res = Response::new(Body::empty());
Err(e) => {
let mut res = Response::new(Body::from(e.to_string()));
*res.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
Ok(res)
}