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 ...@@ -435,15 +435,7 @@ class JiraService < IssueTrackerService
yield yield
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
@error = error @error = error
log_error( log_error("Error sending message", client_url: client_url, error: @error.message)
"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)
}
)
nil nil
end end
......
---
title: Less verbose JiraService error logs
merge_request: 32847
author:
type: other
...@@ -12,12 +12,7 @@ module Gitlab ...@@ -12,12 +12,7 @@ module Gitlab
def request(*args) def request(*args)
result = make_request(*args) result = make_request(*args)
unless result.response.is_a?(Net::HTTPSuccess) raise JIRA::HTTPError.new(result.response) unless result.response.is_a?(Net::HTTPSuccess)
Gitlab::ErrorTracking.track_and_raise_exception(
JIRA::HTTPError.new(result.response),
response: result.body
)
end
result result
end end
......
...@@ -688,22 +688,18 @@ describe JiraService do ...@@ -688,22 +688,18 @@ describe JiraService do
context 'when the test fails' do context 'when the test fails' do
it 'returns result with the error' do it 'returns result with the error' do
test_url = 'http://jira.example.com/rest/api/2/serverInfo' 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]) 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( expect(jira_service).to receive(:log_error).with(
"Error sending message", 'Error sending message',
hash_including( client_url: 'http://jira.example.com',
client_url: url, error: error_message
error: hash_including(
exception_class: 'JIRA::HTTPError',
exception_message: 'Some specific failure.'
)
)
) )
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 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