dtolnay / dtolnay/thiserror

Common prefix

Open
#412 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
5.5k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

Let's say I want to have a common prefix to all my errors, like:

```rust
#[derive(Error)]
enum MatrixParseError {
#[error("Couldn't parse matrix: foo")]
Foo
#[error("Couldn't parse matrix: bar")]
Bar
}
```

It would be cool to have the ability to specify such a prefix. (E.g. as `[error("Couldn't parse matrix: {}")]` on the enum.)

Do you think you could add that? Or do you recommend another idiomatic way of achieving this behavior?

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.