Skip to main content

use_error_boundary

Function use_error_boundary 

Source
pub fn use_error_boundary() -> ErrorBoundary
Expand description

Obtains an ErrorBoundary registered against the current hook context slot.

Behaves like HookContext::use_hook: the same ErrorBoundary is returned on every render at the same hook index, preserving the Idle / Caught(message) phase across renders.

Use ErrorBoundary::try_with to run a closure under the boundary; panics inside the closure are caught and the phase transitions to Caught. The parent’s render code reads ErrorBoundary::phase (a Signal<ErrorBoundaryPhase>) to decide whether to render the children or a fallback.

§Returns

  • ErrorBoundary - The error boundary handle. Returns the factory result directly when no hook context is active (e.g. when called outside a render cycle).