You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my understanding, Go's errors.Is is supposed to be used to one error has the same type as another error, i.e. perform
myErr, ok:=err.(*MyError)
recursively, unwrapping err using errros.Unwrap until a match is found.
The text was updated successfully, but these errors were encountered:
marten-seemann
changed the title
wrong MatchError behavior when the error has an Is definition
wrong MatchError behavior when the error has an Is function
Jun 23, 2021
In my understanding, Go's errors.Is is supposed to be used to one error has the same type as another error, i.e. perform
but I don't think I'm drawing the same conclusion after reading the go docs.
They seem to be saying that if an error type defines Is then that function is called and honored when computing equivalence regardless of type. (Their example with the MyError type being equivalent to fs.ErrExist seems to make this explicit) - am I missing something?
I have an error that (in its minimal form) looks like this:
Now I have the following test case:
This test fails because the second part of this
if
statement:gomega/matchers/match_error_matcher.go
Lines 27 to 29 in 2f04e6e
In my understanding, Go's
errors.Is
is supposed to be used to one error has the same type as another error, i.e. performrecursively, unwrapping
err
usingerrros.Unwrap
until a match is found.The text was updated successfully, but these errors were encountered: