#error #any

anyerror

A type of any error for transport

13 releases

0.1.12 Nov 11, 2023
0.1.10 Oct 18, 2023
0.1.9 Jul 27, 2023
0.1.8 Mar 26, 2023
0.1.6 Mar 12, 2022

#279 in Rust patterns

Download history 6823/week @ 2023-11-02 6142/week @ 2023-11-09 4602/week @ 2023-11-16 6030/week @ 2023-11-23 4980/week @ 2023-11-30 4881/week @ 2023-12-07 4835/week @ 2023-12-14 3759/week @ 2023-12-21 3342/week @ 2023-12-28 4364/week @ 2024-01-04 7634/week @ 2024-01-11 6095/week @ 2024-01-18 5335/week @ 2024-01-25 3980/week @ 2024-02-01 3712/week @ 2024-02-08 6336/week @ 2024-02-15

20,586 downloads per month
Used in 6 crates (2 directly)

Apache-2.0

20KB
442 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.5–1.8MB
~39K SLoC