Skip to content

WalkDeep cannot walk vertical subtrees #72

Closed
@YuJuncen

Description

@YuJuncen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions