diff options
Diffstat (limited to 'lib/error_highlight')
-rw-r--r-- | lib/error_highlight/base.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/error_highlight/base.rb b/lib/error_highlight/base.rb index 51f1ce369d..dbd173a5cd 100644 --- a/lib/error_highlight/base.rb +++ b/lib/error_highlight/base.rb @@ -26,9 +26,9 @@ module ErrorHighlight case obj when Exception exc = obj + loc = opts[:backtrace_location] opts = { point_type: opts.fetch(:point_type, :name) } - loc = opts[:backtrace_location] unless loc case exc when TypeError, ArgumentError @@ -44,6 +44,8 @@ module ErrorHighlight opts[:name] = exc.name if NameError === obj end + return nil unless Thread::Backtrace::Location === loc + node = RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true) Spotter.new(node, **opts).spot |