るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.092秒)

別のキーワード

  1. _builtin backtrace_locations
  2. thread backtrace_locations
  3. _builtin backtrace
  4. exception backtrace_locations
  5. thread backtrace

ライブラリ

クラス

検索結果

Exception#backtrace_locations -> [Thread::Backtrace::Location] (18120.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...b][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end

def get_exception
return begin
yield
rescue => e
e
end
end

e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:...