-
Notifications
You must be signed in to change notification settings - Fork 93
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
Is() is not safe as replacement to errors.Is #25
Comments
Thanks for the report! This module was written before the new go error changes, but it seems like a good idea to integrate with the decisions they chose. It's not technically backward compatible to start using .Is() instead of ==, but I think it's what most users of this library would expect, so it's a change I'm in favor of making. Would you like to send a pull request to fix this? P.S. Out of curiosity, what leads to you still using this library in go > 1.14? I haven't thought hard about it, and at @superhuman we diverged from this library a while ago, so I'm curious if this is still useful now that the standard library has better wrapping/unwrapping and stack-trace support. |
Hello, I just opened a PR to fix it. :) We did not found the support for stack-trace under standard library so we switched to this lib. I did not found any indication on standard library being able to log the caller trace without a panic and we use those stacks in all errors wright now. Though if standard library know allow stack-trace, i'll take a new look on it. |
Ah, it looks like they didn't ship that part of the proposal, my mistake! golang/go#29934 (comment) (it would be great if they did :D — https://go.googlesource.com/proposal/+/master/design/29934-error-values.md#formatting) |
Interesting. I still found this in official documentation today: |
FWIW That's the sneakily named |
👍 I'll stay with go-errors for now then :) |
Hello,
While working around go errors, I had an issue with the Is function.
It does not use the default errors.Is and only compare for strict equality between base errors witch is the default comportment of original Is but not its full implementation.
Basically, we are using a custom error type witch reimplement Is and I expected it to be called on goerrors.Is but it is not the cased.
It also mean that current goerrors.Is will not have expected behaviour on wrapped errors.
The text was updated successfully, but these errors were encountered: