Closed prasannavl closed 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 inDisplay
.
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.)
Display
, the chain of messages will be included in the error message while also returning the source errors via Error::source
, which goes against this guideline.Display
, we're good with the guideline, but SNAFU does not provide an error reporting mechanism that takes the full chain of errors into account, hence requiring users to copy their error reporting boilerplate.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.
Copy over
iter_chain
from Rust unstable intoErrorCompat
Related: https://github.com/shepmaster/snafu/pull/186#discussion_r333283269 Depended by: https://github.com/shepmaster/snafu/pull/186