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 ...@@ -145,7 +145,7 @@ module Gitlab
project.repository.fetch_as_mirror(project.import_url, refmap: self.class.refmap) project.repository.fetch_as_mirror(project.import_url, refmap: self.class.refmap)
log_info(stage: 'import_repository', message: 'finished import') log_info(stage: 'import_repository', message: 'finished import')
rescue Gitlab::Shell::Error => e rescue ::Gitlab::Git::CommandError => e
Gitlab::ErrorTracking.log_exception( Gitlab::ErrorTracking.log_exception(
e, e,
stage: 'import_repository', message: 'failed import', error: e.message stage: 'import_repository', message: 'failed import', error: e.message
......
...@@ -43,10 +43,10 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer do ...@@ -43,10 +43,10 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer do
subject.execute subject.execute
end end
it 'raises a Gitlab::Shell exception in the fetch' do it 'raises a Gitlab::Git::CommandError in the fetch' do
expect(project.repository).to receive(:fetch_as_mirror).and_raise(Gitlab::Shell::Error) 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 end
it 'raises an unhandled exception in the fetch' do 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