Function sources

Source
pub fn sources(err: &dyn Error) -> impl Iterator<Item = &(dyn Error + 'static)>
Expand description

Get an Iterator of the source chain of this error.

Skips err, starting as err.source(). Equivalent to chain(err).skip(1).

ยงExample

let err = errors::wrap("c", errors::wrap("b", "a"));


let expected = ["b", "a"];

for (err, &s) in errors::iter::sources(&err).zip(expected.iter()) {
    assert_eq!(err.to_string(), s);
}