anyerror

Crates.ioanyerror
lib.rsanyerror
version0.1.12
sourcesrc
created_at2022-01-09 12:44:36.271054
updated_at2023-11-11 09:07:41.620975
descriptionA type of any error for transport
homepagehttps://github.com/drmingdrmer/anyerror
repositoryhttps://github.com/drmingdrmer/anyerror
max_upload_size
id510782
size36,367
张炎泼 (drmingdrmer)

documentation

https://docs.rs/anyerror

README

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
Commit count: 25

cargo fmt