color-eyre
A custom context for the eyre crate for colorful error reports, suggestions,
and tracing-error support.
Setup
Add the following to your toml file:
[]
= "0.4"
= "0.3"
And then import the type alias from color-eyre for eyre::Report or eyre::Result.
use Report;
// or
Disabling tracing support
If you don't plan on using tracing_error and SpanTrace you can disable the
tracing integration to cut down on unused dependencies:
[]
= "0.4"
= { = "0.3", = false }
Example
use ;
use WrapErr;
use ;
use ErrorLayer;
use *;
use ;
Minimal Report Format
Short Report Format (with RUST_LIB_BACKTRACE=1)
Full Report Format (with RUST_LIB_BACKTRACE=full)
Explanation
This crate works by defining a Context type which implements eyre::EyreContext
and a pair of type aliases for setting this context type as the parameter of
eyre::Report.
use Context;
pub type Report = Report;
pub type Result<T, E = Report> = Result;
Features
- captures a
backtrace::Backtraceand prints usingcolor-backtrace - captures a
tracing_error::SpanTraceand prints usingcolor-spantrace - Only capture SpanTrace by default for better performance.
- display source lines when
RUST_LIB_BACKTRACE=fullis set - store help text via
Helptrait and display after final report - custom
color-backtraceconfiguration viacolor_eyre::install, such as adding custom frame filters