# error_boundary

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-view/error_boundary/

**module** · [`ferroui-view`](/docs/0.5.0/api/ferroui-view/) · v0.5.0

```rust
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`](/docs/0.5.0/api/ferroui-view/error_boundary/function-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.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/error_boundary.rs#L1)

## Contents

- [`ErrorInfo`](/docs/0.5.0/api/ferroui-view/error_boundary/struct-errorinfo/) — struct
- [`error_boundary`](/docs/0.5.0/api/ferroui-view/error_boundary/function-error_boundary/) — function

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
