Commit ffc13533 authored by Stan Hu's avatar Stan Hu

Fix error handling for Bitbucket Server importer

We no longer use gitlab-shell to clone and fetch, so update the
exception for Gitaly gRPC calls.
parent 006f6c73
......@@ -145,7 +145,7 @@ module Gitlab
project.repository.fetch_as_mirror(project.import_url, refmap: self.class.refmap)
log_info(stage: 'import_repository', message: 'finished import')
rescue Gitlab::Shell::Error => e
rescue ::Gitlab::Git::CommandError => e
Gitlab::ErrorTracking.log_exception(
e,
stage: 'import_repository', message: 'failed import', error: e.message
......
......@@ -43,10 +43,10 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer do
subject.execute
end
it 'raises a Gitlab::Shell exception in the fetch' do
expect(project.repository).to receive(:fetch_as_mirror).and_raise(Gitlab::Shell::Error)
it 'raises a Gitlab::Git::CommandError in the fetch' do
expect(project.repository).to receive(:fetch_as_mirror).and_raise(::Gitlab::Git::CommandError)
expect { subject.execute }.to raise_error(Gitlab::Shell::Error)
expect { subject.execute }.to raise_error(::Gitlab::Git::CommandError)
end
it 'raises an unhandled exception in the fetch' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment