Skip to content
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

WalkDeep cannot walk vertical subtrees #72

Open
YuJuncen opened this issue Dec 17, 2024 · 0 comments
Open

WalkDeep cannot walk vertical subtrees #72

YuJuncen opened this issue Dec 17, 2024 · 0 comments

Comments

@YuJuncen
Copy link

YuJuncen commented Dec 17, 2024

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.

Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant