Improve error handling for unknown sprite icons
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
See this thread for context.
Currently, in the icons_helper.rb we will throw an error on non-production environments if an icon is not found.
def known_sprites
return if Rails.env.production?
@known_sprites ||= Gitlab::Json.parse(File.read(Rails.root.join('node_modules/@gitlab/svgs/dist/icons.json')))['icons']
end
def known_file_icon_sprites
return if Rails.env.production?
@known_file_icon_sprites ||= Gitlab::Json.parse(File.read(Rails.root.join('node_modules/@gitlab/svgs/dist/file_icons/file_icons.json')))['icons']
end
Ideally, we should avoid the production check and see if there's a more graceful way to fail regardless of the environment.
Edited by 🤖 GitLab Bot 🤖