Skip to content

Upper or lower case error messages?  #209

@matklad

Description

@matklad

I've noticed that all examples at https://docs.rs/anyhow/latest/anyhow/ use upper case error messages. This feels a bit odd, as I think the stdlib practice is to use lowercase error messages. There's also inconsistency with thiserror examples:

// anyhow repo: 

#[derive(Error, Debug)]
pub enum FormatError {
    #[error("Invalid header (expected {expected:?}, got {found:?})")]
    InvalidHeader {
        expected: String,
        found: String,
    },
    #[error("Missing attribute: {0}")]
    MissingAttribute(String),
}

// thiserror repo:
#[derive(Error, Debug)]
pub enum DataStoreError {
    #[error("data store disconnected")]
    Disconnect(#[from] io::Error),
    #[error("the data for key `{0}` is not available")]
    Redaction(String),
    #[error("invalid header (expected {expected:?}, found {found:?})")]
    InvalidHeader {
        expected: String,
        found: String,
    },
    #[error("unknown data store error")]
    Unknown,
}

Would it be a good idea to send a PR changing anyhow examples to lowercase?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions