Commit d071b6ae authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '321664-log-jira-import-exceptions' into 'master'

Don't track JiraImport::UsersImporter errors in Sentry

See merge request gitlab-org/gitlab!56498
parents 87943223 b1c95db1
......@@ -13,7 +13,7 @@ module JiraImport
ServiceResponse.success(payload: mapped_users)
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError, OpenSSL::SSL::SSLError => error
Gitlab::ErrorTracking.track_exception(error, project_id: project.id)
Gitlab::ErrorTracking.log_exception(error, project_id: project.id)
ServiceResponse.error(message: "There was an error when communicating to Jira")
rescue Projects::ImportService::Error => error
ServiceResponse.error(message: error.message)
......
......@@ -54,8 +54,11 @@ RSpec.describe JiraImport::UsersImporter do
end
context 'when jira client raises an error' do
let(:error) { Timeout::Error.new }
it 'returns an error response' do
expect(client).to receive(:get).and_raise(Timeout::Error)
expect(client).to receive(:get).and_raise(error)
expect(Gitlab::ErrorTracking).to receive(:log_exception).with(error, project_id: project.id)
expect(subject.error?).to be_truthy
expect(subject.message).to include('There was an error when communicating to Jira')
......
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