From d935c1b8fd65841176a8623afcdf6808daac862b Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Mon, 24 Apr 2023 16:20:11 +0200 Subject: [PATCH] put the info in the panic message --- axum/src/routing/mod.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/axum/src/routing/mod.rs b/axum/src/routing/mod.rs index 4619b2df..97d1047b 100644 --- a/axum/src/routing/mod.rs +++ b/axum/src/routing/mod.rs @@ -306,13 +306,18 @@ where .remove::>() .map(|SuperFallback(path_router)| path_router.into_inner()); - // simulate hitting `unreachable!()` below - unreachable!(); - if let Some(mut super_fallback) = super_fallback { return super_fallback .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) {