dtolnay / dtolnay/anyhow

Upper or lower case error messages?

Open
#209 1 comment 10 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.7k
Forks
224
PR merge metrics
No merged PRs in 30d

Description

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:

```rust
// 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.