You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to propagate any server errors with a certain status code to a higher ErrorBoundary. The docs weren't very clear on it.
The doc example is
rsx! {
ErrorBoundary {
handle_error: |error: ErrorContext| {
// Network errors need to be handled by a different error boundary!
if let Some(err) = error.error() {
return Err(e.into())
}
// Otherwise, handle this error here
rsx! {
div { "Oops, we encountered an error" }
}
},
// ...
}
}
when I try with my code it compiles but creates an infinite error loop
ErrorBoundary {
handle_error: |errors: ErrorContext| {
if let Some(err) = errors.error() {
if let Some(code) = err.downcast_ref::<ServerFnError>().and_then(|e| Some(e.as_status_code()))
&& code == StatusCode::UNAUTHORIZED
{
info!("error propagated");
return Err(err.into());
}
}
rsx! {
div {
class: "text-base-content font-semibold opacity-65",
"Oops, we encountered an error. Please report {errors:?} to the developer of this application"
}
}
},
ChildComponent{}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was trying to propagate any server errors with a certain status code to a higher ErrorBoundary. The docs weren't very clear on it.
The doc example is
when I try with my code it compiles but creates an infinite error loop
Beta Was this translation helpful? Give feedback.
All reactions