2020-04-25 10:07:12 -07:00
2020-04-25 09:14:12 -07:00
2020-04-25 09:31:43 -07:00
2020-04-25 10:01:42 -07:00
2020-04-24 07:43:20 -07:00
2020-04-25 09:14:12 -07:00
2020-04-25 10:07:12 -07:00

color-eyre

A custom context for the eyre crate for colorful error reports, suggestions, and tracing-error support.

Disclaimer: This crate is currently pre-release while I try to upstream changes I made to color-backtrace to support this crate. Until then I cannot publish this to crates.io, the documentation is filled out however so simply run cargo doc --open for an explanation of usage.

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.

pub type Report = eyre::Report<Context>;
pub type Result<T, E = Report> = core::result::Result<T, E>;

Features

Setup

Add the following to your toml file:

[dependencies]
eyre = "0.3.8"
color-eyre = "0.2.0"

And then import the type alias from color-eyre for eyre::Report or eyre::Result.

use color_eyre::Report;

// or

fn example(&self) -> color_eyre::Result<()> {
    // ...
}

Minimal Report Format

minimal report format

Short Report Format (with RUST_LIB_BACKTRACE=1)

short report format

Full Report Format (with RUST_LIB_BACKTRACE=full)

full report format

Description
A trait object based error handling type for easy idiomatic error handling and reporting in Rust applications
Readme 3.7 MiB
Languages
Rust 98.6%
Python 1.3%