Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PartialEq on Error or expose ErrorKind #326

Open
orhun opened this issue Nov 4, 2024 · 0 comments
Open

Implement PartialEq on Error or expose ErrorKind #326

orhun opened this issue Nov 4, 2024 · 0 comments

Comments

@orhun
Copy link

orhun commented Nov 4, 2024

Hello!

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

#[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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant