Commit 4c20cd08 authored by Rajendra Kadam's avatar Rajendra Kadam

Add sentry tracking to masking helper

parent d519789a
......@@ -6,7 +6,8 @@ module Routing
return unless Feature.enabled?(:mask_page_urls, type: :ops)
mask_params(Rails.application.routes.recognize_path(request.original_fullpath))
rescue ActionController::RoutingError, URI::InvalidURIError
rescue ActionController::RoutingError, URI::InvalidURIError => e
Gitlab::ErrorTracking.track_exception(e, url: request.original_fullpath)
nil
end
......
......@@ -129,6 +129,20 @@ RSpec.describe ::Routing::PseudonymizationHelper do
end
end
describe 'when it raises exception' do
context 'calls error tracking exception' do
it 'sends error to sentry' do
allow(helper).to receive(:mask_params).with(anything).and_raise(ActionController::RoutingError, 'Some routing error')
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
ActionController::RoutingError,
url: '').and_call_original
expect(helper.masked_page_url).to be_nil
end
end
end
describe 'when feature flag is disabled' do
before do
stub_feature_flags(mask_page_urls: false)
......
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