micro_errors
Utilities to deal with errors without taking the derive macro approach.
Exposes a struct ErrorChain
to typically be used within the Err
variant of Result
. ErrorChain
contains a recusive struct ErrorLink
containing a summary message or a backtrace of the last link.
Gist
Creating an ErrorChain
from a non ErrorChain
.
Err::
.map_err
.expect_err
Creating an ErrorChain
from an existing ErrorChain
.
println!
Output of the println!
being something like below.
Error no. 0: i dunno
Error no. 1: who I be
Error no. 2: key glock
Approximate backtrace of error no. 2:
0: micro_errors::ErrorLink::severed
at ./src/lib.rs:57:23
1: micro_errors::ErrorChain<alloc::string::String>::start
at ./src/lib.rs:74:13
2: micro_errors::test_crate
at ./src/lib.rs:14:22
3: micro_errors::test_crate::{{closure}}
Again, creating an ErrorChain
from an existing ErrorChain
.
println!;
match Err::