parent
2ebb508cd8
commit
07325dc26f
@ -45,7 +45,7 @@ def backtrace_locations
|
||||
|
||||
private
|
||||
def parse_message_for_trace
|
||||
if source_location_eval?
|
||||
if __getobj__.to_s.start_with?("(eval")
|
||||
# If the exception is coming from a call to eval, we need to keep
|
||||
# the path of the file in which eval was called to ensure we can
|
||||
# return the right source fragment to show the location of the
|
||||
@ -56,15 +56,5 @@ def parse_message_for_trace
|
||||
__getobj__.to_s.split("\n")
|
||||
end
|
||||
end
|
||||
|
||||
if SyntaxError.method_defined?(:path) # Ruby 3.3+
|
||||
def source_location_eval?
|
||||
__getobj__.path.start_with?("(eval")
|
||||
end
|
||||
else # 3.2 and older versions of Ruby
|
||||
def source_location_eval?
|
||||
__getobj__.to_s.start_with?("(eval")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user