Crate tempo_eyre

Crate tempo_eyre 

Source
Expand description

Hooks to format eyre reports with their source chain attached.

The intended use of this error hook is within tracing events, specifically those generated by the #[tracing::instrument(err)] proc macro. This is because error events emitted this way are printed using their std::fmt::Display formatting, while #[instrument(err(Debug))] would print the full source chain but without respecting the formatting desired by the tracing subscriber.

Because errors without their source chain are nigh useless, this crate provides the tempo_eyre::install() hook to install an error handler that formats errors in a list style like [error 0, error 1, error 2].

§Example

tempo_eyre::install();

let err = eyre!("bottom error")
    .wrap_err("middle error")
    .wrap_err("top error");
println!("full source chain: {err}");

This would print:

full source chain: [top error, middle error, bottom error]

Structs§

ErrorHandler 🔒

Functions§

install
Installs the hook as the global error report hook.