diff --git a/lib/errors/filter.go b/lib/errors/filter.go index 6a6b4b26363..909e72d74f5 100644 --- a/lib/errors/filter.go +++ b/lib/errors/filter.go @@ -35,13 +35,6 @@ func Ignore(err error, pred ErrorPredicate) error { // ErrorPredicate is a function type that returns whether an error matches a given condition type ErrorPredicate func(error) bool -// HasTypePred returns an ErrorPredicate that returns true for errors that unwrap to an error with the same type as target -func HasTypePred(target error) ErrorPredicate { - return func(err error) bool { - return HasType(err, target) - } -} - // IsPred returns an ErrorPredicate that returns true for errors that uwrap to the target error func IsPred(target error) ErrorPredicate { return func(err error) bool { @@ -56,7 +49,3 @@ func IsContextCanceled(err error) bool { func IsDeadlineExceeded(err error) bool { return Is(err, context.DeadlineExceeded) } - -func IsContextError(err error) bool { - return IsAny(err, context.Canceled, context.DeadlineExceeded) -} diff --git a/lib/errors/filter_test.go b/lib/errors/filter_test.go index 2438334f438..c11a150d6f3 100644 --- a/lib/errors/filter_test.go +++ b/lib/errors/filter_test.go @@ -13,7 +13,6 @@ func (t *testError) Error() string { return "testError" } func TestIgnore(t *testing.T) { testError1 := New("test1") testError2 := New("test2") - testError3 := &testError{} cases := []struct { input error @@ -51,13 +50,6 @@ func TestIgnore(t *testing.T) { check: func(t *testing.T, err error) { require.NoError(t, err) }, - }, { - input: Append(testError1, testError3), - pred: HasTypePred(testError3), - check: func(t *testing.T, err error) { - require.ErrorIs(t, err, testError1) - require.False(t, HasType(err, testError3)) - }, }, { input: Wrap(Append(testError1, testError2), "wrapped"), pred: IsPred(testError1),