lib/reek/source/source_code.rb in reek-4.5.6 vs lib/reek/source/source_code.rb in reek-4.6.0
- old
+ new
@@ -3,10 +3,11 @@
Reek::CLI::Silencer.silently do
require 'parser/ruby23'
end
require_relative '../tree_dresser'
require_relative '../ast/node'
+require_relative '../errors/parse_error'
# Opt in to new way of representing lambdas
Parser::Builders::Default.emit_lambda = true
module Reek
@@ -85,10 +86,10 @@
@syntax_tree ||=
begin
begin
ast, comments = parser.parse_with_comments(source, origin)
rescue Racc::ParseError, Parser::SyntaxError => error
- $stderr.puts "#{origin}: #{error.class.name}: #{error}"
+ raise Errors::ParseError, origin: origin, original_exception: error
end
# See https://whitequark.github.io/parser/Parser/Source/Comment/Associator.html
comment_map = Parser::Source::Comment.associate(ast, comments) if ast
TreeDresser.new.dress(ast, comment_map)