Project

General

Profile

Actions

Bug #9295

closed

`Exception#backtrace_locations` returns `nil`

Added by sawa (Tsuyoshi Sawada) over 10 years ago. Updated about 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:59306]

Description

=begin
If I raise an ArgumentError by calling a method with wrong number of arguments, Exception#backtrace_locations returns nil, which I think is a bug:

def foo; end

begin
  foo(:bar)
rescue => e
  p e.backtrace_locations
end
# => nil

If, instead, I raise an error manually, then it returns an array as expected:

begin
  raise ArgumentError.new
rescue => e
  p e.backtrace_locations
end
# => ["this_file:2:in `<main>'"]

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0