#[source]
- to identify underlying cause
- field marked
#[source]
or is namedsource
Examples
Source
#[derive(Error, Debug)]
pub struct MyError {
msg: String,
#[source] // optional if field name is `source`
source: anyhow::Error,
}
Caveats
- source must implement
Error
orDeref<Target = dyn Error>