rust-lang-deprecated / failure

Error management

Home Page:https://rust-lang-nursery.github.io/failure/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using `Error` as a cause loses backtrace.

Diggsey opened this issue · comments

The AsFail implementation for Error only looks for a backtrace on the underlying Fail, and skips backtraces attached directly to the Error. This means that Errors constructed from implementors of the std::error::Error trait lose their backtraces when they are used as a cause.

Confusion around this resulted in rust-lang/crater#455. Ideally, Error would implement Fail, but this is impossible due to coherence issues (#99). Absent that, it would be nice if there was a way to abstract over both Error and Context without throwing away the Backtrace.