error_boundary
module · ferroui-view · v0.5.0
module error_boundary
Error boundaries: a component that shows a fallback instead of ending the
application when a run of a component below it panics
(error_boundary).
A component mounted below a boundary runs its function under
catch_unwind (mount.rs). A run that panics renders nothing, the
runtime and the frames of the hooks are put back as they were before the
run, and the panic is reported to the nearest boundary above, which is
found through the contexts of the owners. The boundary does not change
its tree there: the report waits until the outermost run of a component in
progress has ended, so no tree is patched while it is being reconciled.
Then the boundary's state changes, the boundary runs again and shows its
fallback, and the child tree, the component that panicked included, is
taken out and its owner disposed.
Only the function of a component is guarded: a panic in a handler, in an
effect started by effect or use_effect, or in the mounting of controls
propagates as before. Without a boundary above, a component runs as it did
before, and a panic propagates.
Contents
ErrorInfo— structerror_boundary— function
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.