-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
As an example router:
#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
enum Route {
#[layout(Frame)]
#[route("/")]
Home {},
#[route("/about")]
About {},
#[route("/:..route")]
PageNotFound { route: Vec<String> },
}
And using the errors example:
fn app() -> Element {
rsx! {
ErrorBoundary {
handle_error: move |err| {
// To ensure the HTTP status is still set properly, we need to call `commit_error_status`
let http_error = FullstackContext::commit_error_status(err.error().unwrap());
// and then we can render some pretty fallback UI
rsx! { "An error occurred! {http_error:?}" }
},
Post {}
}
}
}
fn Post() -> Element {
let post_data = use_loader(move || get_post())?;
rsx! { p { "{post_data" } }
}
The ErrorBoundary is never hit, because the status code sent is always 200 OK.
Is there a straightforward way to have a catch-all route send an error so that the ErrorBoundary is activated?
Metadata
Metadata
Assignees
Labels
No labels