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:
authorPavlo Strokov <pstrokov@gitlab.com>2022-09-27 09:40:11 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2022-11-11 13:44:58 +0300
commite978322c85c9a2f469eb0ad26fe3d66daccac410 (patch)
tree5f3599d4b5e0789452c97229270a043d7141833c
parent081d52b6b28437bc8d3a17b6e3d8d80620c640f9 (diff)
internalgitaly: Standardize errors creation
Return Internal code in case of an unexpected operation failure instead of Undefined by using helper.ErrInternal(). Replace usage of status.Errorf() with helper.ErrNotFoundf() to make error creation more standard.
-rw-r--r--internal/gitaly/service/internalgitaly/walkrepos.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/internal/gitaly/service/internalgitaly/walkrepos.go b/internal/gitaly/service/internalgitaly/walkrepos.go
index fec13966c..6dad15e01 100644
--- a/internal/gitaly/service/internalgitaly/walkrepos.go
+++ b/internal/gitaly/service/internalgitaly/walkrepos.go
@@ -6,9 +6,8 @@ import (
"path/filepath"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/storage"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/helper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
)
@@ -18,7 +17,7 @@ func (s *server) WalkRepos(req *gitalypb.WalkReposRequest, stream gitalypb.Inter
return err
}
- return walkStorage(stream.Context(), sPath, stream)
+ return helper.ErrInternal(walkStorage(stream.Context(), sPath, stream))
}
func (s *server) storagePath(storageName string) (string, error) {
@@ -27,10 +26,7 @@ func (s *server) storagePath(storageName string) (string, error) {
return storage.Path, nil
}
}
- return "", status.Errorf(
- codes.NotFound,
- "storage name %q not found", storageName,
- )
+ return "", helper.ErrNotFoundf("storage name %q not found", storageName)
}
func walkStorage(ctx context.Context, storagePath string, stream gitalypb.InternalGitaly_WalkReposServer) error {