pub enum ErrorBoundaryState {
Healthy,
Failed(CapturedError),
Recovering {
attempts: u32,
last_error: CapturedError,
},
}Expand description
State for an error boundary.
A panic moves Healthy to Recovering: the fallback is drawn and the
boundary retries the widget on the next render. Each retry that panics
again counts one attempt; once max_recovery_attempts retries have
failed the state is Failed, which shows the fallback without calling
the widget until reset or try_recover.
A retry that renders cleanly returns to Healthy.
Variants§
Healthy
Widget is rendering normally.
Failed(CapturedError)
Retries are exhausted (or disabled): the fallback is shown and the widget is no longer called.
Recovering
The widget panicked; the fallback is shown and the next render retries it.
Fields
attempts: u32Retries scheduled so far, including the pending one; never more
than the boundary’s max_recovery_attempts.
last_error: CapturedErrorThe most recent panic.
Implementations§
Source§impl ErrorBoundaryState
impl ErrorBoundaryState
Sourcepub fn error(&self) -> Option<&CapturedError>
pub fn error(&self) -> Option<&CapturedError>
Returns the current error, if any.
Sourcepub fn try_recover(&mut self, max_attempts: u32) -> bool
pub fn try_recover(&mut self, max_attempts: u32) -> bool
Attempt recovery. Returns true if recovery attempt was initiated.