Skip to content
Snippets Groups Projects
Commit 4c20cd08 authored by Rajendra Kadam's avatar Rajendra Kadam :two:
Browse files

Add sentry tracking to masking helper

parent d519789a
No related branches found
No related tags found
1 merge request!70891Add sentry tracking to mask url helper
......@@ -6,7 +6,8 @@ def masked_page_url
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 @@
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment