Commit 4d2882b1 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '218648-remove-jira-httperror-non-actionable-exceptions' into 'master'

Remove JIRA::HTTPError non-actionable exceptions

Closes #218648

See merge request gitlab-org/gitlab!32847
parents da6c493e 1a50778b
......@@ -435,15 +435,7 @@ class JiraService < IssueTrackerService
yield
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError, OpenSSL::SSL::SSLError => error
@error = error
log_error(
"Error sending message",
client_url: client_url,
error: {
exception_class: error.class.name,
exception_message: error.message,
exception_backtrace: Gitlab::BacktraceCleaner.clean_backtrace(error.backtrace)
}
)
log_error("Error sending message", client_url: client_url, error: @error.message)
nil
end
......
---
title: Less verbose JiraService error logs
merge_request: 32847
author:
type: other
......@@ -12,12 +12,7 @@ module Gitlab
def request(*args)
result = make_request(*args)
unless result.response.is_a?(Net::HTTPSuccess)
Gitlab::ErrorTracking.track_and_raise_exception(
JIRA::HTTPError.new(result.response),
response: result.body
)
end
raise JIRA::HTTPError.new(result.response) unless result.response.is_a?(Net::HTTPSuccess)
result
end
......
......@@ -688,22 +688,18 @@ describe JiraService do
context 'when the test fails' do
it 'returns result with the error' do
test_url = 'http://jira.example.com/rest/api/2/serverInfo'
error_message = 'Some specific failure.'
WebMock.stub_request(:get, test_url).with(basic_auth: [username, password])
.to_raise(JIRA::HTTPError.new(double(message: 'Some specific failure.')))
.to_raise(JIRA::HTTPError.new(double(message: error_message)))
expect(jira_service).to receive(:log_error).with(
"Error sending message",
hash_including(
client_url: url,
error: hash_including(
exception_class: 'JIRA::HTTPError',
exception_message: 'Some specific failure.'
)
)
'Error sending message',
client_url: 'http://jira.example.com',
error: error_message
)
expect(jira_service.test(nil)).to eq(success: false, result: 'Some specific failure.')
expect(jira_service.test(nil)).to eq(success: false, result: error_message)
end
end
end
......
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