Skip to content

Commit abf8d01

Browse files
committed
fix(yew-router): include route pattern and error in build_router panic
matchit has stricter conflict detection than route-recognizer, so users migrating with ambiguous routes (e.g. `/{id}` and `/{name}`) will hit this panic. The old message ("failed to insert route") gave no indication of which route or why; now it shows both.
1 parent 2101b96 commit abf8d01

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/yew-router/src/macro_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn build_router<R: Routable>() -> Router {
2222
let stripped_route = strip_slash_suffix(path);
2323
router
2424
.insert(stripped_route, path.to_string())
25-
.expect("failed to insert route");
25+
.unwrap_or_else(|e| panic!("failed to insert route {stripped_route:?}: {e}"));
2626
});
2727

2828
router

0 commit comments

Comments
 (0)