summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/wraps_gitaly_errors.rb
blob: 4b161f7e6ceb0ab7d4d103d0e3d43dc299c79576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Gitlab
  module Git
    module WrapsGitalyErrors
      def wrapped_gitaly_errors(&block)
        yield block
      rescue GRPC::NotFound => e
        raise Gitlab::Git::Repository::NoRepository.new(e)
      rescue GRPC::InvalidArgument => e
        raise ArgumentError.new(e)
      rescue GRPC::BadStatus => e
        raise Gitlab::Git::CommandError.new(e)
      end
    end
  end
end