Commit b1c95db1 authored by Markus Koller's avatar Markus Koller

Don't track JiraImport::UsersImporter errors in Sentry

parent cffdff1f
...@@ -13,7 +13,7 @@ module JiraImport ...@@ -13,7 +13,7 @@ module JiraImport
ServiceResponse.success(payload: mapped_users) ServiceResponse.success(payload: mapped_users)
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError, OpenSSL::SSL::SSLError => error 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") ServiceResponse.error(message: "There was an error when communicating to Jira")
rescue Projects::ImportService::Error => error rescue Projects::ImportService::Error => error
ServiceResponse.error(message: error.message) ServiceResponse.error(message: error.message)
......
...@@ -54,8 +54,11 @@ RSpec.describe JiraImport::UsersImporter do ...@@ -54,8 +54,11 @@ RSpec.describe JiraImport::UsersImporter do
end end
context 'when jira client raises an error' do context 'when jira client raises an error' do
let(:error) { Timeout::Error.new }
it 'returns an error response' do 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.error?).to be_truthy
expect(subject.message).to include('There was an error when communicating to Jira') 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