diff options
author | Chris Wilson <chris@chrisjwilson.com> | 2017-05-23 08:15:51 +0300 |
---|---|---|
committer | Chris Wilson <chris@chrisjwilson.com> | 2017-05-23 08:17:10 +0300 |
commit | 5b8f8d2bdc9f69aa4e28375b8a79ab9671ed6a1c (patch) | |
tree | d66a302ddac7b3acfebc2e0d7f268d5d651a2505 | |
parent | 39baadbd017a1e36cf95b0ad1a503015bd5e562f (diff) |
Rescue test settings for chat notification servicesmrchrisw-handle-chat-error
Return error message to show user when testing chat
notification services.
-rw-r--r-- | app/models/project_services/chat_notification_service.rb | 7 | ||||
-rw-r--r-- | changelogs/unreleased/mrchrisw-handle-chat-error.yml | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/app/models/project_services/chat_notification_service.rb b/app/models/project_services/chat_notification_service.rb index 779ef54cfcb..41fbd8c8c1c 100644 --- a/app/models/project_services/chat_notification_service.rb +++ b/app/models/project_services/chat_notification_service.rb @@ -86,6 +86,13 @@ class ChatNotificationService < Service raise NotImplementedError end + def test(data) + result = execute(data) + { success: true, result: result } + rescue HTTParty::Error, Timeout::Error, SocketError, Errno::ECONNRESET, Errno::ECONNREFUSED, OpenSSL::SSL::SSLError => error + { success: false, result: error.message } + end + private def notify(message, opts) diff --git a/changelogs/unreleased/mrchrisw-handle-chat-error.yml b/changelogs/unreleased/mrchrisw-handle-chat-error.yml new file mode 100644 index 00000000000..7ac6d6fee23 --- /dev/null +++ b/changelogs/unreleased/mrchrisw-handle-chat-error.yml @@ -0,0 +1,4 @@ +--- +title: Rescue test settings for chat notification services +merge_request: +author: |