rust-errkit 0.1.0

Idiomatic Rust error handling kit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use rust_errkit::{
    AppError,
    kind::{ErrorKind, ErrorReason},
};

fn main() {
    let err = AppError::from(ErrorKind::db(ErrorReason::ConnectionFailed))
        .with_context("sqlx", Some("connection refused".to_string()));

    println!("MESSAGE: {}", err.kind.message());

    if let Some(ctx) = err.context {
        println!("SOURCE: {}", ctx.source);
        println!("DETAILS: {:?}", ctx.details);
    }
}