dtolnay / dtolnay/semver

Implement PartialEq on `Error` or expose `ErrorKind`

Open
#326 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
669
Forks
144
PR merge metrics
No merged PRs in 30d

Description

Hello!

I would like to use the error type of `semver` in my project via `thiserror` like so:

```rust
#[derive(Debug, thiserror::Error, PartialEq)]
pub enum ParseError {
/// An invalid semantic version string
///
/// This error occurs when a semantic version cannot be parsed from a string
#[error("Invalid semver: {0} ({1:?})")]
InvalidSemver(String, #[source] semver::Error),
}
```

However, this is not possible due to `semver::Error` does not implement `PartialEq`. Manually implementing that is a pain since I have a many other error variants.

Another thing that I thought about is using `semver::ErrorKind` but that's not exposed.

Can you help me with the case above? I'm also happy to submit a PR. LMK!

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.