diff --git a/crates/ptth_relay/src/lib.rs b/crates/ptth_relay/src/lib.rs index c17067b..dfcd0d0 100644 --- a/crates/ptth_relay/src/lib.rs +++ b/crates/ptth_relay/src/lib.rs @@ -355,7 +355,8 @@ async fn handle_all ( } } 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 == "/" { let s = handlebars.render ("root", &())?; @@ -438,15 +439,22 @@ pub async fn run_relay ( } let make_svc = make_service_fn (|_conn| { + use std::convert::Infallible; + let state = state.clone (); let handlebars = handlebars.clone (); async { - Ok::<_, RequestError> (service_fn (move |req| { + Ok::<_, Infallible> (service_fn (move |req| { let state = state.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 () + })) + } })) } });