Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Guidelines for implementing Display and Error::source for library errors #27

Open
@Nemo157

Description

@Nemo157

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions