shepmaster / snafu

Easily assign underlying errors into domain-specific errors while adding context
https://docs.rs/snafu/
Apache License 2.0
1.45k stars 61 forks source link

Implement `iter_chain` on ErrorCompat #187

Closed prasannavl closed 3 years ago

prasannavl commented 5 years ago

Copy over iter_chain from Rust unstable into ErrorCompat

Related: https://github.com/shepmaster/snafu/pull/186#discussion_r333283269 Depended by: https://github.com/shepmaster/snafu/pull/186

Enet4 commented 3 years ago

I would like to assist in this, as this seems to be the main blocker towards an error reporting abstraction for SNAFU.

The error handling working group has recently decided(see comment) on an error design guideline.

Return source errors via Error::source unless the source error's message is included in your own error message in Display.

And SNAFU sits in a tricky situation, due to how it is natural for source errors constructed via context selectors to also become available via Error::source. (I am not sure if there is a way to override this, although this feels hardly desirable.)

I am not entirely sure of how one should go about this in the project, but I could take an attempt and let it go under review as a PR.