Commit c09b0b23 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'sh-add-missing-backtrace-define' into 'master'

Fix Bitbucket Server importer error handler

See merge request gitlab-org/gitlab!23310
parents d876bd60 233a0404
---
title: Fix Bitbucket Server importer error handler
merge_request: 23310
author:
type: fixed
......@@ -172,6 +172,7 @@ module Gitlab
stage: 'import_pull_requests', iid: pull_request.iid, error: e.message
)
backtrace = Gitlab::BacktraceCleaner.clean_backtrace(e.backtrace)
errors << { type: :pull_request, iid: pull_request.iid, errors: e.message, backtrace: backtrace.join("\n"), raw_response: pull_request.raw }
end
end
......
......@@ -67,6 +67,7 @@ describe Gitlab::BitbucketServerImport::Importer do
author_email: project.owner.email,
created_at: Time.now,
updated_at: Time.now,
raw: {},
merged?: true)
allow(subject.client).to receive(:pull_requests).and_return([pull_request])
......@@ -239,6 +240,13 @@ describe Gitlab::BitbucketServerImport::Importer do
expect(notes.first.note).to start_with('*Comment on .gitmodules')
expect(notes.second.note).to start_with('*Comment on .gitmodules')
end
it 'reports an error if an exception is raised' do
allow(subject).to receive(:import_bitbucket_pull_request).and_raise(RuntimeError)
expect(Gitlab::ErrorTracking).to receive(:log_exception)
subject.execute
end
end
describe 'inaccessible branches' 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