Module: Gitlab::Git::WrapsGitalyErrors

Included in:
Blob, Commit, CommitStats, Conflict::Resolver, Patches::CommitPatches, RemoteMirror, Repository, RepositoryCleaner, Tree, Wiki
Defined in:
lib/gitlab/git/wraps_gitaly_errors.rb

Instance Method Summary collapse

Instance Method Details

#wrapped_gitaly_errors(&block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/gitlab/git/wraps_gitaly_errors.rb', line 6

def wrapped_gitaly_errors(&block)
  yield block
rescue GRPC::BadStatus => e
  # The GRPC::BadStatus is the fundamental error that serves as the basis for all other gRPC error categories,
  # including GRPC::InvalidArgument. It is essential to note that rescuing the specific exception class does not
  # account for all possible cases. In this regard, a status exception can be directly generated from
  # GRPC::BadStatus. Therefore, it is recommended that we capture and rescue the GRPC::BadStatus and assert the
  # status code to ensure adequate coverage of error cases.
  handle_error(e)
end