Guidelines for implementing Display and Error::source for library errors #27
Description
I have been involved in trying to fix a couple of crates errors to work better with error reporters like anyhow
/eyre
recently (clap-rs/clap#2151, sunng87/handlebars-rust#398). One big issue I find with reporting these sorts of issues is not having a succinct, canonical "this is how errors should be implemented" source to link to. The only api-guideline related is C-GOOD-ERR which doesn't talk about chaining at all, and simply says:
The error message given by the
Display
representation of an error type should be lowercase without trailing punctuation, and typically concise.
It would be very useful to have something to link to which talks about chaining to sources, not adding unnecessary "Error: " prefixes, and not printing your source
's message as part of your own message. (I'm assuming a chapter/appendix in the error-book, or a new section in the api-guidelines).