snafu 0.6.7

An ergonomic error handling library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use snafu::{ResultExt, Snafu};

#[derive(Debug, Snafu)]
enum InnerError {
    #[snafu(display("inner error"))]
    AnError,
}

#[derive(Debug, Snafu)]
enum Error {
    NoDisplay { source: InnerError },
}

#[test]
fn default_error_display() {
    let err: Error = AnError.fail::<()>().context(NoDisplay).unwrap_err();
    assert_eq!(format!("{}", err), "NoDisplay: inner error",);
}