14 releases

0.1.13 Jan 7, 2025
0.1.12 Nov 11, 2023
0.1.10 Oct 18, 2023
0.1.9 Jul 27, 2023
0.1.6 Mar 12, 2022

#728 in Rust patterns

Download history 4940/week @ 2024-10-22 5213/week @ 2024-10-29 5994/week @ 2024-11-05 5176/week @ 2024-11-12 6429/week @ 2024-11-19 5736/week @ 2024-11-26 5347/week @ 2024-12-03 5892/week @ 2024-12-10 5956/week @ 2024-12-17 5495/week @ 2024-12-24 4905/week @ 2024-12-31 8186/week @ 2025-01-07 4870/week @ 2025-01-14 7890/week @ 2025-01-21 7053/week @ 2025-01-28 5650/week @ 2025-02-04

26,318 downloads per month
Used in 21 crates (5 directly)

Apache-2.0

21KB
460 lines

AnyError

AnyError is a serializable casing for Error.

AnyError can be employed to transform other Error types into a serializable Error for transmission, preserving most of the essential information.

let err = fmt::Error {};
let e = AnyError::new(&err)
            .add_context(|| "running test")
            .add_context(|| "developing new feature");
println!("{:#}", e);

The above code will print error description with context:

core::fmt::Error: an error occurred when formatting an argument
    while: running test
    while: developing new feature

Dependencies

~0.3–6MB
~36K SLoC