lib/rbs/errors.rb in rbs-1.6.2 vs lib/rbs/errors.rb in rbs-1.7.0.beta.1

- old
+ new

@@ -13,12 +13,25 @@ "#{type_name}#{separator}#{method_name}" end end class ErrorBase < StandardError; end - class ParsingError < ErrorBase; end class LoadingError < ErrorBase; end class DefinitionError < ErrorBase; end + + class ParsingError < ErrorBase + attr_reader :location + attr_reader :error_message + attr_reader :token_type + + def initialize(location, error_message, token_type) + @location = location + @error_message = error_message + @token_type = token_type + + super "#{Location.to_string location}: Syntax error: #{error_message}, token=`#{location.source}` (#{token_type})" + end + end class InvalidTypeApplicationError < DefinitionError attr_reader :type_name attr_reader :args attr_reader :params