summaryrefslogtreecommitdiff
path: root/app/helpers/icons_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/icons_helper.rb')
-rw-r--r--app/helpers/icons_helper.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb
index 4f73270577f..876789e0d4a 100644
--- a/app/helpers/icons_helper.rb
+++ b/app/helpers/icons_helper.rb
@@ -42,11 +42,9 @@ module IconsHelper
end
def sprite_icon(icon_name, size: nil, css_class: nil)
- if Gitlab::Sentry.should_raise_for_dev?
- unless known_sprites.include?(icon_name)
- exception = ArgumentError.new("#{icon_name} is not a known icon in @gitlab-org/gitlab-svg")
- raise exception
- end
+ if known_sprites&.exclude?(icon_name)
+ exception = ArgumentError.new("#{icon_name} is not a known icon in @gitlab-org/gitlab-svg")
+ Gitlab::ErrorTracking.track_and_raise_for_dev_exception(exception)
end
css_classes = []
@@ -158,6 +156,8 @@ module IconsHelper
private
def known_sprites
+ return if Rails.env.production?
+
@known_sprites ||= JSON.parse(File.read(Rails.root.join('node_modules/@gitlab/svgs/dist/icons.json')))['icons']
end
end