Skip to content

Commit

Permalink
Handle errors reading or parsing manifest file
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Dec 23, 2021
1 parent b5ff408 commit df1a527
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/helpers/script_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def render_javascript_pack_once_tags(*names)
private

def manifest
@manifest ||= JSON.parse(File.read(MANIFEST_PATH))
@manifest ||= begin
JSON.parse(File.read(MANIFEST_PATH))
rescue JSON::ParserError, Errno::ENOENT
{}
end
end
end
# rubocop:enable Rails/HelperInstanceVariable

0 comments on commit df1a527

Please sign in to comment.