We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2fd2a1b + ac4101e commit 8504c52Copy full SHA for 8504c52
lib/error_highlight/base.rb
@@ -54,7 +54,16 @@ def self.spot(obj, **opts)
54
55
return nil unless Thread::Backtrace::Location === loc
56
57
- node = RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true)
+ node =
58
+ begin
59
+ RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true)
60
+ rescue RuntimeError => error
61
+ # RubyVM::AbstractSyntaxTree.of raises an error with a message that
62
+ # includes "prism" when the ISEQ was compiled with the prism compiler.
63
+ # In this case, we'll set the node to `nil`. In the future, we will
64
+ # reparse with the prism parser and pass the parsed node to Spotter.
65
+ raise unless error.message.include?("prism")
66
+ end
67
68
Spotter.new(node, **opts).spot
69
0 commit comments