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

Comparing Errors #1562

Closed
derekdreery opened this Issue Feb 17, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@derekdreery
Contributor

derekdreery commented Feb 17, 2018

It would be helpful if it were possible to compare errors using (Partial)Eq, and also implement things like Hash/Ord for datastructures. I'm not sure if this is really possible, but if not it may be possible to work around this by implementing PartialEq by making any trait object comparisons falsey.

What are your thoughts on this? Do you think it would be useful?

@killercup

This comment has been minimized.

Member

killercup commented Feb 17, 2018

What's your use case? Matching on the error variant is usually the way to go.

@derekdreery

This comment has been minimized.

Contributor

derekdreery commented Feb 17, 2018

I'm trying to create my own ErrorKind setting the ConnectionError as the cause.

sgrif added a commit that referenced this issue Feb 17, 2018

Implement `PartialEq` for `ConnectionError`
We do this for other error types, and it's trivial to do here.

Fixes #1562.

@sgrif sgrif closed this in #1564 Feb 18, 2018

@derekdreery

This comment has been minimized.

Contributor

derekdreery commented Feb 18, 2018

Nice one!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment