lib/eco/api/common/session/file_manager.rb in eco-helpers-1.0.8 vs lib/eco/api/common/session/file_manager.rb in eco-helpers-1.0.9
- old
+ new
@@ -48,10 +48,16 @@
File.read(file)
end
def load_json(filename)
content = file_content(filename)
- return content && JSON.parse(content)
+ begin
+ parsed = content && JSON.parse(content)
+ rescue JSON::ParserError => e
+ pp "Parsing error on file #{filename}"
+ raise e
+ end
+ return parsed
end
def touch(filename, modifier = :no_stamp, mode: :string)
save("", filename, modifier, mode: mode)
end