summaryrefslogtreecommitdiff
path: root/internal/handler/exec.go
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2021-09-17 18:29:59 +0300
committerIgor Drozdov <idrozdov@gitlab.com>2021-09-17 18:48:54 +0300
commit3fee6d5d70465bc57e0ba201d82ce1561052efb7 (patch)
tree378baec653f1ed6b880660cb694c293c956e4a4f /internal/handler/exec.go
parent37025e61e570e748613d9a5a57a7ae5de1b45af5 (diff)
downloadgitlab-shell-3fee6d5d70465bc57e0ba201d82ce1561052efb7.tar.gz
Improve err message given when Gitaly unavailable
Diffstat (limited to 'internal/handler/exec.go')
-rw-r--r--internal/handler/exec.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go
index eb5211e..172736d 100644
--- a/internal/handler/exec.go
+++ b/internal/handler/exec.go
@@ -9,7 +9,9 @@ import (
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"google.golang.org/grpc"
+ grpccodes "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
+ grpcstatus "google.golang.org/grpc/status"
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/accessverifier"
@@ -50,6 +52,12 @@ func (gc *GitalyCommand) RunGitalyCommand(ctx context.Context, handler GitalyHan
childCtx := withOutgoingMetadata(ctx, gc.Features)
_, err = handler(childCtx, conn)
+ if err != nil && grpcstatus.Convert(err).Code() == grpccodes.Unavailable {
+ log.WithError(err).Error("Gitaly is unavailable")
+
+ return fmt.Errorf("Git service is temporarily unavailable")
+ }
+
return err
}