errors
errors copied to clipboard
`WalkDeep` cannot walk vertical subtrees
Give an tree of errors:
A + B - C
|
+ D - E
For now WalkDeep walks A and multierr(B-C, D-E) and then returns. It isn't deep enough.
An example of this:
func TestErr(t *testing.T) {
serr := backup.MakeStoreBasedErr(42, multierr.Combine(
errors.Annotate(berrors.ErrFailedToConnect, "oops"),
berrors.ErrFailedToConnect.GenWithStack("whoa")))
require.True(t, berrors.Is(serr, berrors.ErrFailedToConnect))
}
Where StoreBasedErr is a wrapper of an err and implements Unwrap to its inner error, berrors.Is is simply:
func Is(err error, is *errors.Error) bool {
errorFound := errors.Find(err, func(e error) bool {
normalizedErr, ok := e.(*errors.Error)
return ok && normalizedErr.ID() == is.ID()
})
return errorFound != nil
}
This testcase fails.