From f21f0c4c916f149b234ae39a23a3bb9ce8c5c346 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 14 Dec 2022 12:05:21 +0100 Subject: helper: Convert and drop usage of `ErrAbortedf()` Convert callers of `ErrAbortedf()` to instead use the `structerr` package. Remove the now-unused function. --- internal/helper/error.go | 6 ------ internal/helper/error_test.go | 7 +------ 2 files changed, 1 insertion(+), 12 deletions(-) (limited to 'internal/helper') 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 @@ -44,11 +44,6 @@ func TestErrorf(t *testing.T) { errorf: ErrNotFoundf, expectedCode: codes.NotFound, }, - { - desc: "ErrAbortedf", - errorf: ErrAbortedf, - expectedCode: codes.Aborted, - }, { desc: "ErrDataLossf", errorf: ErrDataLossf, @@ -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": { -- cgit v1.2.3