# PanicError

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/struct-panicerror/

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

```rust
struct PanicError
```

The error of a panic of user code, caught where upstream catches an exception: the message
of the panic.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/internal/panic_exception.rs#L21)

## Members

- [`message`](#struct_field-message)
- [`from_payload`](#function-from_payload)
- [`catch`](#function-catch)

<a id="struct_field-message"></a>

### message

```rust
message: String
```

The message of the panic (`Exception.Message`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/internal/panic_exception.rs#L23)

<a id="function-from_payload"></a>

### from_payload

```rust
fn from_payload(payload: &dyn Any + Send) -> ObservableError
```

The error of a caught panic: an `UnhandledError` stays one, any other payload
becomes a `PanicError` with the text of the payload.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/internal/panic_exception.rs#L41)

<a id="function-catch"></a>

### catch

```rust
fn catch<R>(action: impl FnOnce() -> R) -> Result<R, (ObservableError, Box<dyn Any + Send>)>
```

Runs `action` and catches its panic (`try { action() } catch (Exception ex)`): the result,
or the error of the panic with its payload, which `std::panic::resume_unwind` rethrows
(`throw;`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/internal/panic_exception.rs#L56)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- `Clone`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Display`
- [`Error`](/docs/0.5.0/api/ferroui-dynamic-data/kernel/struct-error/)

## Availability

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