anyerror

Crates.ioanyerror
lib.rsanyerror
version0.1.13
sourcesrc
created_at2022-01-09 12:44:36.271054
updated_at2025-01-07 04:17:05.39254
descriptionA type of any error for transport
homepagehttps://github.com/drmingdrmer/anyerror
repositoryhttps://github.com/drmingdrmer/anyerror
max_upload_size
id510782
size37,179
张炎泼 (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: 29

cargo fmt