-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router does not match #[not_found] if it fails to parse into the target type #2106
Comments
This behavior is intentional. I kept it that way because more often than not, you would want to display a 404 message related to path segment missing. For example, you might want to display " |
I don't think the current method has a way to recover from the "no route matched" error.
|
This is what I'd expect too - #2107 would limit
I think it could be useful to add a debug console log for when Also when we support nested routers then you could do this easily if you wanted to have a topic specific not found behaviour - though you'd probably have something like this: #[derive(Routable, Debug, Clone, PartialEq)]
pub(crate) enum AppRoute {
#[at("/")]
Home,
#[at("/article")]
Article,
#[at("/404")]
#[not_found]
NotFound,
}
// somewhere else
#[derive(Routable, Debug, Clone, PartialEq)]
pub(crate) enum ArticleRoute {
#[at("/")]
Articles,
#[at("/:id")]
Article { id: u64 },
#[at("/404")]
#[not_found]
NotFound,
} This is just to give an idea - I know that nested routers are still in flux API wise :) |
Problem
And the output is:
When using this route with
Router
, if the path matches/anything-but-u64
, the router will simply stop rendering withno route matched
.Expected behavior
The output of the snippet above should be:
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
master
wasm32-unknown-unknown
Questionnaire
The text was updated successfully, but these errors were encountered: