Exception: RBI::UnexpectedParserError

Inherits:
Error
  • Object
show all
Defined in:
lib/rbi/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent_exception, last_location) ⇒ UnexpectedParserError

: (Exception parent_exception, Loc last_location) -> void



23
24
25
26
27
# File 'lib/rbi/parser.rb', line 23

def initialize(parent_exception, last_location)
  super(parent_exception)
  set_backtrace(parent_exception.backtrace)
  @last_location = last_location
end

Instance Attribute Details

#last_locationObject (readonly)

: Loc



20
21
22
# File 'lib/rbi/parser.rb', line 20

def last_location
  @last_location
end

Instance Method Details

: (?io: (IO | StringIO)) -> void



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rbi/parser.rb', line 30

def print_debug(io: $stderr)
  io.puts ""
  io.puts "##################################"
  io.puts "### RBI::Parser internal error ###"
  io.puts "##################################"
  io.puts ""
  io.puts "There was an internal parser error while processing this source."
  io.puts ""
  io.puts "Error: #{message} while parsing #{last_location}:"
  io.puts ""
  io.puts last_location.source || "<no source>"
  io.puts ""
  io.puts "Please open an issue at https://github.com/Shopify/rbi/issues/new."
  io.puts ""
  io.puts "##################################"
  io.puts ""
end