diff --git a/retry/constant_test.go b/retry/constant_test.go index d2d7871..5bbe508 100644 --- a/retry/constant_test.go +++ b/retry/constant_test.go @@ -78,7 +78,7 @@ func Test_constantRetryer_Retry(t *testing.T) { f: func() error { count++ - return UnexpectedError(fmt.Errorf("unexpected")) + return fmt.Errorf("unexpected") }, }, expectedCount: 1, @@ -96,7 +96,7 @@ func Test_constantRetryer_Retry(t *testing.T) { f: func() error { count++ if count == 2 { - return UnexpectedError(fmt.Errorf("unexpected")) + return fmt.Errorf("unexpected") } return ExpectedError(fmt.Errorf("unexpected")) diff --git a/retry/exponential_test.go b/retry/exponential_test.go index 5592e8e..c05c97f 100644 --- a/retry/exponential_test.go +++ b/retry/exponential_test.go @@ -78,7 +78,7 @@ func Test_exponentialRetryer_Retry(t *testing.T) { f: func() error { count++ - return UnexpectedError(fmt.Errorf("unexpected")) + return fmt.Errorf("unexpected") }, }, expectedCount: 1, @@ -96,7 +96,7 @@ func Test_exponentialRetryer_Retry(t *testing.T) { f: func() error { count++ if count == 2 { - return UnexpectedError(fmt.Errorf("unexpected")) + return fmt.Errorf("unexpected") } return ExpectedError(fmt.Errorf("unexpected")) diff --git a/retry/linear_test.go b/retry/linear_test.go index dc87e82..1f608ca 100644 --- a/retry/linear_test.go +++ b/retry/linear_test.go @@ -78,7 +78,7 @@ func Test_linearRetryer_Retry(t *testing.T) { f: func() error { count++ - return UnexpectedError(fmt.Errorf("unexpected")) + return fmt.Errorf("unexpected") }, }, expectedCount: 1, @@ -96,7 +96,7 @@ func Test_linearRetryer_Retry(t *testing.T) { f: func() error { count++ if count == 1 { - return UnexpectedError(fmt.Errorf("unexpected")) + return fmt.Errorf("unexpected") } return ExpectedError(fmt.Errorf("unexpected")) diff --git a/retry/retry.go b/retry/retry.go index 0fc92e1..60c81f4 100644 --- a/retry/retry.go +++ b/retry/retry.go @@ -161,6 +161,8 @@ func ExpectedError(err error) error { // UnexpectedError error represents an error that is unexpected by the retrying // function. This error is fatal. +// +// Deprecated: all errors are unexpected by default, just return them. func UnexpectedError(err error) error { if err == nil { return nil diff --git a/retry/retry_test.go b/retry/retry_test.go index 8747515..37a4baf 100644 --- a/retry/retry_test.go +++ b/retry/retry_test.go @@ -47,7 +47,7 @@ func Test_retry(t *testing.T) { name: "unexpected error string", args: args{ c: context.Background(), - f: func(context.Context) error { return UnexpectedError(errors.New("test")) }, + f: func(context.Context) error { return errors.New("test") }, d: 2 * time.Second, t: NewConstantTicker(NewDefaultOptions()), o: &Options{},