Rescue OpenSSL::SSL::SSLError in JiraService and IssueTrackerService

Add OpenSSL::SSL::SSLError to rescue in JiraService & IssueTrackerService. This
will prevent an exception in production and instead display
a message to the user.
This commit is contained in:
Chris Wilson 2017-05-18 16:20:16 +10:00
parent 39baadbd01
commit 8c07184250
3 changed files with 6 additions and 2 deletions

View File

@ -76,7 +76,7 @@ class IssueTrackerService < Service
message = "#{self.type} received response #{response.code} when attempting to connect to #{self.project_url}"
result = true
end
rescue HTTParty::Error, Timeout::Error, SocketError, Errno::ECONNRESET, Errno::ECONNREFUSED => error
rescue HTTParty::Error, Timeout::Error, SocketError, Errno::ECONNRESET, Errno::ECONNREFUSED, OpenSSL::SSL::SSLError => error
message = "#{self.type} had an error when trying to connect to #{self.project_url}: #{error.message}"
end
Rails.logger.info(message)

View File

@ -294,7 +294,7 @@ class JiraService < IssueTrackerService
def jira_request
yield
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError => e
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError, OpenSSL::SSL::SSLError => e
Rails.logger.info "#{self.class.name} Send message ERROR: #{url} - #{e.message}"
nil
end

View File

@ -0,0 +1,4 @@
---
title: Rescue OpenSSL::SSL::SSLError in JiraService & IssueTrackerService
merge_request:
author: