🐛 bug: make sure errors are sent to tracing

main
_ 2021-02-20 16:36:45 +00:00
parent 9a984f5a4e
commit f53973ddad
1 changed files with 11 additions and 3 deletions

View File

@ -355,7 +355,8 @@ async fn handle_all (
} }
} }
else if let Some (rest) = prefix_match ("/frontend/debug/", &path) { else if let Some (rest) = prefix_match ("/frontend/debug/", &path) {
Ok (error_reply (StatusCode::NOT_IMPLEMENTED, "Not implemented (yet)")?) let s = handlebars.render ("debug", &())?;
Ok (ok_reply (s)?)
} }
else if path == "/" { else if path == "/" {
let s = handlebars.render ("root", &())?; let s = handlebars.render ("root", &())?;
@ -438,15 +439,22 @@ pub async fn run_relay (
} }
let make_svc = make_service_fn (|_conn| { let make_svc = make_service_fn (|_conn| {
use std::convert::Infallible;
let state = state.clone (); let state = state.clone ();
let handlebars = handlebars.clone (); let handlebars = handlebars.clone ();
async { async {
Ok::<_, RequestError> (service_fn (move |req| { Ok::<_, Infallible> (service_fn (move |req| {
let state = state.clone (); let state = state.clone ();
let handlebars = handlebars.clone (); let handlebars = handlebars.clone ();
handle_all (req, state, handlebars) async {
Ok::<_, Infallible> (handle_all (req, state, handlebars).await.unwrap_or_else (|e| {
error! ("{}", e);
error_reply (StatusCode::INTERNAL_SERVER_ERROR, "Error in relay").unwrap ()
}))
}
})) }))
} }
}); });