Skip to content

<feature>(IS): Use original errors.Is as final test for Is function #26

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

Merged
merged 1 commit into from
May 29, 2020

Conversation

titouanfreville
Copy link
Collaborator

issue: Current is does not support custom Is definition on underlying errors
fix proposition: delegate the error check to standard errors.Is checker
so it does have expected behaviour on wrapped errors as well as custom
Is implementation

@titouanfreville
Copy link
Collaborator Author

Fix proposition for #25

Copy link
Contributor

@ConradIrwin ConradIrwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix, two small improvements, then we're ready to go.

.gitignore Outdated
@@ -0,0 +1 @@
.idea
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please remove this extra file.

func Is(e error, original error) bool {

if e == original {
if baseErrors.Is(e, original) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N.B. This will only compile on go1.13 and above – given that go only supports the two most recent major releases, I think that it's ok for us to drop go1.12 support; but we should add something to the README to let people know that this has happened.

Could you please add a section

## Changelog
* v1.1.0 updated to use go1.13's standard-library errors.Is method instead of == in errors.Is

issue: Current is does not support custom Is definition on underlying errors
fix proposition: delegate the error check to standard errors.Is checker
so it does have expected behaviour on wrapped errors as well as custom
Is implementation
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

Successfully merging this pull request may close these issues.

2 participants