Skip to content

Commit c8ecebe

Browse files
committed
Merge pull request #65 from codeclimate/will/runtimeerror
Catch RuntimeError when parsing
2 parents 21899c6 + 6715ad1 commit c8ecebe

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/cc/engine/analyzers/analyzer_base.rb

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@ class Base
99
::Errno::ENOENT,
1010
::Racc::ParseError,
1111
::RubyParser::SyntaxError,
12-
]
12+
::RuntimeError,
13+
].freeze
1314

1415
def initialize(engine_config:)
1516
@engine_config = engine_config
1617
end
1718

1819
def run(file)
1920
process_file(file)
20-
rescue *RESCUABLE_ERRORS => ex
21-
$stderr.puts("Skipping file #{file} due to exception (#{ex.class}): #{ex.message}\n#{ex.backtrace.join("\n")}")
2221
rescue => ex
23-
$stderr.puts("#{ex.class} error occurred processing file #{file}: aborting.")
24-
raise ex
22+
if RESCUABLE_ERRORS.map { |klass| ex.instance_of?(klass) }.include?(true)
23+
$stderr.puts("Skipping file #{file} due to exception (#{ex.class}): #{ex.message}\n#{ex.backtrace.join("\n")}")
24+
else
25+
$stderr.puts("#{ex.class} error occurred processing file #{file}: aborting.")
26+
raise ex
27+
end
2528
end
2629

2730
def files

0 commit comments

Comments
 (0)