diff options
Diffstat (limited to 'internal/service/remote/fetch_internal_remote.go')
-rw-r--r-- | internal/service/remote/fetch_internal_remote.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/service/remote/fetch_internal_remote.go b/internal/service/remote/fetch_internal_remote.go index c8eaed507..fc61d7b82 100644 --- a/internal/service/remote/fetch_internal_remote.go +++ b/internal/service/remote/fetch_internal_remote.go @@ -2,8 +2,10 @@ package remote import ( "context" + "errors" "fmt" + "gitlab.com/gitlab-org/gitaly/internal/helper" "gitlab.com/gitlab-org/gitaly/internal/rubyserver" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -40,3 +42,14 @@ func validateFetchInternalRemoteRequest(req *gitalypb.FetchInternalRemoteRequest return nil } + +// FetchInternalRemoteErrorOnFailure fetches another Gitaly repository set as a remote +func (s *server) FetchInternalRemoteErrorOnFailure(ctx context.Context, req *gitalypb.FetchInternalRemoteRequest) (*gitalypb.FetchInternalRemoteResponse, error) { + resp, err := s.FetchInternalRemote(ctx, req) + + if !resp.Result { + return nil, helper.ErrInternal(errors.New("fetch failed")) + } + + return resp, err +} |