diff options
-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') |