るりまサーチ

最速Rubyリファレンスマニュアル検索!
16件ヒット [1-16件を表示] (0.399秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:*[x] > クエリ:report_on_exception=[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Thread.report_on_exception=(newstate) (24236.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...を $stderr に報告します。

デフォルトは false です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block...
...in>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:

*
例外が意図し...
...所で rescue して、
その例外でスレッドが終了しないようにするのがより良い方法です。
*
Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false で...
...容を $stderr に報告します。

デフォルトは true です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `blo...

Thread.report_on_exception -> bool (9236.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...を $stderr に報告します。

デフォルトは false です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block...
...in>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:

*
例外が意図し...
...所で rescue して、
その例外でスレッドが終了しないようにするのがより良い方法です。
*
Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false で...
...容を $stderr に報告します。

デフォルトは true です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `blo...