put the info in the panic message

This commit is contained in:
David Pedersen 2023-04-24 16:20:11 +02:00
parent 07cd3c8f4f
commit d935c1b8fd

View file

@ -306,13 +306,18 @@ where
.remove::<SuperFallback<S, B>>() .remove::<SuperFallback<S, B>>()
.map(|SuperFallback(path_router)| path_router.into_inner()); .map(|SuperFallback(path_router)| path_router.into_inner());
// simulate hitting `unreachable!()` below
unreachable!();
if let Some(mut super_fallback) = super_fallback { if let Some(mut super_fallback) = super_fallback {
return super_fallback return super_fallback
.call_with_state(req, state) .call_with_state(req, state)
.unwrap_or_else(|_| unreachable!()); .unwrap_or_else(|(req, _)| {
let version = req.version();
let method = req.method();
let uri = req.uri();
let headers = req.headers();
unreachable!(
"version={version:?}; method={method:?}; uri={uri:?}; headers={headers:?}",
)
});
} }
match self.fallback_router.call_with_state(req, state) { match self.fallback_router.call_with_state(req, state) {