diff --git a/actix-router/src/resource.rs b/actix-router/src/resource.rs index eb0483a5..a3ea8a1c 100644 --- a/actix-router/src/resource.rs +++ b/actix-router/src/resource.rs @@ -927,7 +927,9 @@ impl ResourceDef { } _ => false, }) - .expect("malformed dynamic segment"); + .unwrap_or_else(|| { + panic!(r#"path "{}" contains malformed dynamic segment"#, pattern) + }); let (mut param, mut unprocessed) = pattern.split_at(close_idx + 1);