diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-12 09:00:16 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-14 14:05:23 +0300 |
commit | 922dc85073351a5b80696f8ece70f7a82827d221 (patch) | |
tree | d35122c2700fbae34dd8d4674ce6bba068b69edf | |
parent | f21f0c4c916f149b234ae39a23a3bb9ce8c5c346 (diff) |
helper: Convert and drop usage of `ErrDataLossf()`
Convert callers of `ErrDataLossf()` to instead use the
`structerr` package. Remove the now-unused function.
-rw-r--r-- | internal/gitaly/service/repository/calculate_checksum.go | 3 | ||||
-rw-r--r-- | internal/helper/error.go | 6 | ||||
-rw-r--r-- | internal/helper/error_test.go | 5 |
3 files changed, 2 insertions, 12 deletions
diff --git a/internal/gitaly/service/repository/calculate_checksum.go b/internal/gitaly/service/repository/calculate_checksum.go index 3e02712ac..83b81a5a9 100644 --- a/internal/gitaly/service/repository/calculate_checksum.go +++ b/internal/gitaly/service/repository/calculate_checksum.go @@ -10,6 +10,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/git" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service" "gitlab.com/gitlab-org/gitaly/v15/internal/helper" + "gitlab.com/gitlab-org/gitaly/v15/internal/structerr" "gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb" ) @@ -45,7 +46,7 @@ func (s *server) CalculateChecksum(ctx context.Context, in *gitalypb.CalculateCh return &gitalypb.CalculateChecksumResponse{Checksum: git.ZeroChecksum}, nil } - return nil, helper.ErrDataLossf("not a git repository '%s'", repoPath) + return nil, structerr.NewDataLoss("not a git repository '%s'", repoPath) } return &gitalypb.CalculateChecksumResponse{Checksum: hex.EncodeToString(checksum.Bytes())}, nil diff --git a/internal/helper/error.go b/internal/helper/error.go index 4c4fd20ac..ceae025e0 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...) } -// ErrDataLossf wraps a formatted error with codes.DataLoss, unless the formatted error is a wrapped -// gRPC error. -func ErrDataLossf(format string, a ...interface{}) error { - return formatError(codes.DataLoss, format, a...) -} - // ErrUnknownf wraps a formatted error with codes.Unknown, unless the formatted error is a wrapped // gRPC error. func ErrUnknownf(format string, a ...interface{}) error { diff --git a/internal/helper/error_test.go b/internal/helper/error_test.go index c4f4e7841..49aa3d3e3 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: "ErrDataLossf", - errorf: ErrDataLossf, - expectedCode: codes.DataLoss, - }, - { desc: "ErrUnknownf", errorf: ErrUnknownf, expectedCode: codes.Unknown, |