From 8750c7555d954509ce0070d5d4b05e25c72683d2 Mon Sep 17 00:00:00 2001 From: Ufuk Kayserilioglu Date: Sat, 14 May 2022 00:44:45 +0300 Subject: [PATCH] Fail gracefully if we get unparsable JSON We seem to sometimes not read enough bytes from the Sorbet output, which ends up causing us to get an error from the JSON parser. While we investigate and fix that root cause, we might as well gracefully handle JSON parsing errors. --- lib/tapioca/static/symbol_table_parser.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tapioca/static/symbol_table_parser.rb b/lib/tapioca/static/symbol_table_parser.rb index 3111eacc4..f41fc20fb 100644 --- a/lib/tapioca/static/symbol_table_parser.rb +++ b/lib/tapioca/static/symbol_table_parser.rb @@ -16,6 +16,8 @@ def self.parse_json(json_string) parser = SymbolTableParser.new parser.parse_object(obj) parser.symbols + rescue JSON::ParserError + Set.new end sig { returns(T::Set[String]) }