提交 2b5e521f 编写于 作者: J Justin Collins

Remove `rescue Exception` instances

closes #428
上级 b3b15be7
......@@ -100,7 +100,7 @@ class Brakeman::Checks
begin
check.run_check
rescue Exception => e
rescue => e
tracker.error e
end
......@@ -138,7 +138,7 @@ class Brakeman::Checks
begin
check.run_check
rescue Exception => e
rescue => e
error_mutex.synchronize do
tracker.error e
end
......
......@@ -58,7 +58,7 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
e
end
end
rescue Exception => err
rescue => err
@tracker.error err if @tracker
end
......
......@@ -20,7 +20,7 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
@inside_concat = false
if exp.second_arg
raise Exception.new("Did not expect more than a single argument to _erbout.concat")
raise "Did not expect more than a single argument to _erbout.concat"
end
arg = exp.first_arg
......
......@@ -30,7 +30,7 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
out = exp.first_arg = process(arg)
@inside_concat = false
else
raise Exception.new("Empty _hamlout.#{method}()?")
raise "Empty _hamlout.#{method}()?"
end
if string? out
......@@ -46,7 +46,7 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
Sexp.new :format, out
end
else
raise Exception.new("Unrecognized action on _hamlout: #{method}")
raise "Unrecognized action on _hamlout: #{method}"
end
end
......
......@@ -18,7 +18,7 @@ class Brakeman::OutputProcessor < Ruby2Ruby
def process exp
begin
super exp if sexp? exp and not exp.empty?
rescue Exception => e
rescue => e
Brakeman.debug "While formatting #{exp}: #{e}\n#{e.backtrace.join("\n")}"
end
end
......
......@@ -26,7 +26,7 @@ class Brakeman::TemplateProcessor < Brakeman::BaseProcessor
def process exp
begin
super
rescue Exception => e
rescue => e
except = e.exception("Error when processing #{@current_template[:name]}: #{e.message}")
except.set_backtrace(e.backtrace)
raise except
......
......@@ -95,7 +95,7 @@ class Brakeman::Scanner
@processor.process_config(parse_ruby(@app_tree.read(path)))
end
rescue Exception => e
rescue => e
Brakeman.notify "[Notice] Error while processing #{path}"
tracker.error e.exception(e.message + "\nwhile processing #{path}"), e.backtrace
end
......@@ -111,7 +111,7 @@ class Brakeman::Scanner
@processor.process_gems(parse_ruby(@app_tree.read("Gemfile")))
end
end
rescue Exception => e
rescue => e
Brakeman.notify "[Notice] Error while processing Gemfile."
tracker.error e.exception(e.message + "\nWhile processing Gemfile"), e.backtrace
end
......@@ -131,7 +131,7 @@ class Brakeman::Scanner
@processor.process_initializer(path, parse_ruby(@app_tree.read_path(path)))
rescue Racc::ParseError => e
tracker.error e, "could not parse #{path}. There is probably a typo in the file. Test it with 'ruby_parse #{path}'"
rescue Exception => e
rescue => e
tracker.error e.exception(e.message + "\nWhile processing #{path}"), e.backtrace
end
end
......@@ -162,7 +162,7 @@ class Brakeman::Scanner
@processor.process_lib parse_ruby(@app_tree.read_path(path)), path
rescue Racc::ParseError => e
tracker.error e, "could not parse #{path}. There is probably a typo in the file. Test it with 'ruby_parse #{path}'"
rescue Exception => e
rescue => e
tracker.error e.exception(e.message + "\nWhile processing #{path}"), e.backtrace
end
end
......@@ -174,7 +174,7 @@ class Brakeman::Scanner
if @app_tree.exists?("config/routes.rb")
begin
@processor.process_routes parse_ruby(@app_tree.read("config/routes.rb"))
rescue Exception => e
rescue => e
tracker.error e.exception(e.message + "\nWhile processing routes.rb"), e.backtrace
Brakeman.notify "[Notice] Error while processing routes - assuming all public controller methods are actions."
options[:assume_all_routes] = true
......@@ -219,7 +219,7 @@ class Brakeman::Scanner
@processor.process_controller(parse_ruby(@app_tree.read_path(path)), path)
rescue Racc::ParseError => e
tracker.error e, "could not parse #{path}. There is probably a typo in the file. Test it with 'ruby_parse #{path}'"
rescue Exception => e
rescue => e
tracker.error e.exception(e.message + "\nWhile processing #{path}"), e.backtrace
end
end
......@@ -305,7 +305,7 @@ class Brakeman::Scanner
tracker.error e, "could not parse #{path}"
rescue Haml::Error => e
tracker.error e, ["While compiling HAML in #{path}"] << e.backtrace
rescue Exception => e
rescue StandardError, LoadError => e
tracker.error e.exception(e.message + "\nWhile processing #{path}"), e.backtrace
end
end
......@@ -339,7 +339,7 @@ class Brakeman::Scanner
@processor.process_model(parse_ruby(@app_tree.read_path(path)), path)
rescue Racc::ParseError => e
tracker.error e, "could not parse #{path}"
rescue Exception => e
rescue => e
tracker.error e.exception(e.message + "\nWhile processing #{path}"), e.backtrace
end
end
......
......@@ -88,7 +88,7 @@ class Brakeman::SexpProcessor
def error_handler(type, exp=nil) # :nodoc:
begin
return yield
rescue StandardError => err
rescue => err
warn "#{err.class} Exception thrown while processing #{type} for sexp #{exp.inspect} #{caller.inspect}" if $DEBUG
raise
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册