Struct eyre::DefaultHandler

source ·
pub struct DefaultHandler { /* private fields */ }
Expand description

The default provided error report handler for eyre::Report.

On nightly this supports conditionally capturing a std::backtrace::Backtrace if the source error did not already capture one.

Implementations§

Manual hook which constructs DefaultHandlers.

Details

When supplied to the set_hook function, default_with will cause eyre::Report to use DefaultHandler as the error report handler.

If the auto-install feature is enabled, and a user-provided hook for constructing EyreHandlers was not installed using set_hook, DefaultHandler::default_with is automatically installed as the hook.

Example
use eyre::{DefaultHandler, eyre, InstallError, Result, set_hook};

fn main() -> Result<()> {
    install_default().expect("default handler inexplicably already installed");
    Err(eyre!("hello from default error city!"))
}

fn install_default() -> Result<(), InstallError> {
    set_hook(Box::new(DefaultHandler::default_with))
}

Trait Implementations§

Formats the value using the given formatter. Read more
Define the report format Read more
Store the location of the caller who constructed this error report
Override for the Display format

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.