Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-07 12:55:47 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-15 16:15:09 +0300
commitf23495c24f2d10642f5f0ca50e7d34faf277b5d0 (patch)
tree6d8ec53a61b8d90f952247e46d7e26c05678f450
parent225f65632a92cfce478c02fad065f01b82592eb6 (diff)
repository: Improve error reporting for Repack RPCs
The errors reported in our Repack RPCs may not be wrapped and are lacking breadcrumbs. Fix both issues by using `helper.ErrInternalf()`.
-rw-r--r--internal/gitaly/service/repository/repack.go4
-rw-r--r--internal/gitaly/service/repository/repack_test.go12
2 files changed, 8 insertions, 8 deletions
diff --git a/internal/gitaly/service/repository/repack.go b/internal/gitaly/service/repository/repack.go
index a8d2460c8..66184ef1b 100644
--- a/internal/gitaly/service/repository/repack.go
+++ b/internal/gitaly/service/repository/repack.go
@@ -37,7 +37,7 @@ func (s *server) RepackFull(ctx context.Context, in *gitalypb.RepackFullRequest)
repackCounter.WithLabelValues(fmt.Sprint(in.GetCreateBitmap())).Inc()
if err := housekeeping.RepackObjects(ctx, repo, cfg); err != nil {
- return nil, helper.ErrInternal(err)
+ return nil, helper.ErrInternalf("repacking objects: %w", err)
}
return &gitalypb.RepackFullResponse{}, nil
@@ -57,7 +57,7 @@ func (s *server) RepackIncremental(ctx context.Context, in *gitalypb.RepackIncre
repackCounter.WithLabelValues(fmt.Sprint(false)).Inc()
if err := housekeeping.RepackObjects(ctx, repo, cfg); err != nil {
- return nil, err
+ return nil, helper.ErrInternalf("repacking objects: %w", err)
}
return &gitalypb.RepackIncrementalResponse{}, nil
diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go
index 705134269..9de79dba3 100644
--- a/internal/gitaly/service/repository/repack_test.go
+++ b/internal/gitaly/service/repository/repack_test.go
@@ -118,12 +118,12 @@ func TestRepackIncrementalFailure(t *testing.T) {
{
desc: "invalid storage name",
repo: &gitalypb.Repository{StorageName: "foo"},
- err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository")),
+ err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`repacking objects: GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository")),
},
{
desc: "no storage name",
repo: &gitalypb.Repository{RelativePath: "bar"},
- err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository")),
+ err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`repacking objects: GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository")),
},
{
desc: "non-existing repo",
@@ -131,7 +131,7 @@ func TestRepackIncrementalFailure(t *testing.T) {
err: status.Error(
codes.NotFound,
gitalyOrPraefect(
- fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
+ fmt.Sprintf(`repacking objects: GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
praefectErr,
),
),
@@ -263,12 +263,12 @@ func TestRepackFullFailure(t *testing.T) {
{
desc: "invalid storage name",
repo: &gitalypb.Repository{StorageName: "foo"},
- err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository")),
+ err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`repacking objects: GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository")),
},
{
desc: "no storage name",
repo: &gitalypb.Repository{RelativePath: "bar"},
- err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository")),
+ err: status.Error(codes.InvalidArgument, gitalyOrPraefect(`repacking objects: GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository")),
},
{
desc: "non-existing repo",
@@ -276,7 +276,7 @@ func TestRepackFullFailure(t *testing.T) {
err: status.Error(
codes.NotFound,
gitalyOrPraefect(
- fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
+ fmt.Sprintf(`repacking objects: GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
praefectErr,
),
),