diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-14 14:05:21 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-14 14:05:21 +0300 |
commit | f21f0c4c916f149b234ae39a23a3bb9ce8c5c346 (patch) | |
tree | 59ac9d67bab1ede96f252b02e858ca44ef1f9f53 /internal/helper | |
parent | 2175c8a8f4519bc6a286eb289285e0bf720a67f5 (diff) |
helper: Convert and drop usage of `ErrAbortedf()`
Convert callers of `ErrAbortedf()` to instead use the
`structerr` package. Remove the now-unused function.
Diffstat (limited to 'internal/helper')
-rw-r--r-- | internal/helper/error.go | 6 | ||||
-rw-r--r-- | internal/helper/error_test.go | 7 |
2 files changed, 1 insertions, 12 deletions
diff --git a/internal/helper/error.go b/internal/helper/error.go index 82b209743..4c4fd20ac 100644 --- a/internal/helper/error.go +++ b/internal/helper/error.go @@ -57,12 +57,6 @@ func ErrAlreadyExistsf(format string, a ...interface{}) error { return formatError(codes.AlreadyExists, format, a...) } -// ErrAbortedf wraps a formatted error with codes.Aborted, unless the formatted error is a wrapped -// gRPC error. -func ErrAbortedf(format string, a ...interface{}) error { - return formatError(codes.Aborted, format, a...) -} - // ErrDataLossf wraps a formatted error with codes.DataLoss, unless the formatted error is a wrapped // gRPC error. func ErrDataLossf(format string, a ...interface{}) error { diff --git a/internal/helper/error_test.go b/internal/helper/error_test.go index 65a625297..c4f4e7841 100644 --- a/internal/helper/error_test.go +++ b/internal/helper/error_test.go @@ -45,11 +45,6 @@ func TestErrorf(t *testing.T) { expectedCode: codes.NotFound, }, { - desc: "ErrAbortedf", - errorf: ErrAbortedf, - expectedCode: codes.Aborted, - }, - { desc: "ErrDataLossf", errorf: ErrDataLossf, expectedCode: codes.DataLoss, @@ -221,7 +216,7 @@ func TestGrpcCode(t *testing.T) { exp: codes.NotFound, }, "double helper wrapped status": { - in: ErrAbortedf("outer: %w", fmt.Errorf("context: %w", ErrNotFoundf(""))), + in: ErrFailedPreconditionf("outer: %w", fmt.Errorf("context: %w", ErrNotFoundf(""))), exp: codes.NotFound, }, "nil input": { |