るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.008秒)
トップページ > クラス:Exception[x] > クエリ:cause[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. _builtin cause
  2. exception cause
  3. cause _builtin
  4. cause exception

ライブラリ

検索結果

Exception#cause -> Exception | nil (18109.0)

self の前の例外(self が rescue 節や ensure 節の中で発生した例外の場合、 その前に発生していた元々の例外)を返します。存在しない場合は nil を返し ます。

...その前に発生していた元々の例外)を返します。存在しない場合は nil を返し
ます。

//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
p $! # => #<RuntimeError: outer>
p $!.cause # => #<RuntimeError: inner>
end
//}...