diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-05-04 15:47:47 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-05-04 15:48:01 +0300 |
commit | 5d003f3d1dfcc5f743c6c1bcd17e84bf4646bf78 (patch) | |
tree | bdf568ac71985f71db7c2107688f304104d853e8 | |
parent | 073c1a0e73ee515d1e87178a3f9d7905c11f6d31 (diff) |
Ensure web hook 'blocked URL' errors are stored in as web hook logs and properly surfaced to the user
-rw-r--r-- | app/services/web_hook_service.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/dm-webhook-catch-blocked-url-exception.yml | 6 | ||||
-rw-r--r-- | spec/services/web_hook_service_spec.rb | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/app/services/web_hook_service.rb b/app/services/web_hook_service.rb index 809ce1303d8..7ec52b6ce2b 100644 --- a/app/services/web_hook_service.rb +++ b/app/services/web_hook_service.rb @@ -41,7 +41,7 @@ class WebHookService http_status: response.code, message: response.to_s } - rescue SocketError, OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Net::OpenTimeout, Net::ReadTimeout => e + rescue SocketError, OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Net::OpenTimeout, Net::ReadTimeout, Gitlab::HTTP::BlockedUrlError => e log_execution( trigger: hook_name, url: hook.url, diff --git a/changelogs/unreleased/dm-webhook-catch-blocked-url-exception.yml b/changelogs/unreleased/dm-webhook-catch-blocked-url-exception.yml new file mode 100644 index 00000000000..6fcb16a3445 --- /dev/null +++ b/changelogs/unreleased/dm-webhook-catch-blocked-url-exception.yml @@ -0,0 +1,6 @@ +--- +title: Ensure web hook 'blocked URL' errors are stored in as web hook logs and properly + surfaced to the user +merge_request: +author: +type: fixed diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb index 2ef2e61babc..7995f2c9ae7 100644 --- a/spec/services/web_hook_service_spec.rb +++ b/spec/services/web_hook_service_spec.rb @@ -67,7 +67,7 @@ describe WebHookService do end it 'handles exceptions' do - exceptions = [SocketError, OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Net::OpenTimeout, Net::ReadTimeout] + exceptions = [SocketError, OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Net::OpenTimeout, Net::ReadTimeout, Gitlab::HTTP::BlockedUrlError] exceptions.each do |exception_class| exception = exception_class.new('Exception message') |