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
Error unwrapping implemented incorrectly in 0.4.0 #698
Comments
Hey @jbowes, What's the issue you have/found? |
That's fair, but I think it's tricky for two reasons:
|
Fair points. You are welcome to send a patch or I can address this later. Thanks 🙂 |
Thank you! We'll see who gets to it first :) |
A recent change Updated how validation errors implement the error Unwrap interface. The change calls errors.Unwrap() instead of returning the
err
field.This is incorrect (the previous behaviour was correct) because
errors.Unwrap
returns either the error that the passed-in error wraps, or nil if the passed-in error doesn't implement Unwrap.Effectively, the immediate error contained in the validation error will never be returned -- it will always be skipped over, having its wrapped error returned instead.
This matters for
errors.Is
anderrors.As
. If an error in the chain is skipped over, then the outermost error will not respond correctly to those two funcs.The text was updated successfully, but these errors were encountered: