Skip to content

Commit

Permalink
Make error message only render when called
Browse files Browse the repository at this point in the history
  • Loading branch information
benwis committed Sep 28, 2023
1 parent cb90afb commit 21fb842
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions integrations/axum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,13 @@ where
// 2. Find RouteListing in paths. This should probably be optimized, we probably don't want to
// search for this every time
let listing: &RouteListing =
paths.iter().find(|r| r.path() == path).expect(&format!(
"Failed to find the route {} requested by the user. This \
suggests that the routing rules in the Router that call this \
handler needs to be edited!",
path
));
paths.iter().find(|r| r.path() == path).unwrap_or_else(|_| {
panic!(
"Failed to find the route {path} requested by the user. \
This suggests that the routing rules in the Router that \
call this handler needs to be edited!"
)
});
// 3. Match listing mode against known, and choose function
match listing.mode() {
SsrMode::OutOfOrder => ooo(req),
Expand Down

0 comments on commit 21fb842

Please sign in to comment.