by vikeri · 1y ago · 0 comments
Edit: looking more carefully at the lib I assume that ”tag” is the concept that is supposed to cover this?
func (myError) Is(err error) bool
and it can match different sentinel errors.
Or you can make your own wrapper to have the error chain match.> An error is considered to match a target if it is equal to that target or if it implements a method Is(error) bool such that Is(target) returns true.
by default errors.Is matches the exact error variable, but you can use it to match other errors as well.