Skip to content

Catch RuntimeError when parsing #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/cc/engine/analyzers/analyzer_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ class Base
::Errno::ENOENT,
::Racc::ParseError,
::RubyParser::SyntaxError,
]
::RuntimeError,
].freeze

def initialize(engine_config:)
@engine_config = engine_config
end

def run(file)
process_file(file)
rescue *RESCUABLE_ERRORS => ex
$stderr.puts("Skipping file #{file} due to exception (#{ex.class}): #{ex.message}\n#{ex.backtrace.join("\n")}")
rescue => ex
$stderr.puts("#{ex.class} error occurred processing file #{file}: aborting.")
raise ex
if RESCUABLE_ERRORS.map { |klass| ex.instance_of?(klass) }.include?(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before anybody asks: ActiveSupport is not included in this gem, and it doesn't seem worth adding just for this.

$stderr.puts("Skipping file #{file} due to exception (#{ex.class}): #{ex.message}\n#{ex.backtrace.join("\n")}")
else
$stderr.puts("#{ex.class} error occurred processing file #{file}: aborting.")
raise ex
end
end

def files
Expand Down