ライブラリ
- English (11)
- ビルトイン (492)
- bigdecimal (113)
- drb (11)
- e2mmap (78)
- fileutils (22)
- json (11)
-
json
/ add / exception (22) -
minitest
/ unit (4) -
net
/ http (11) - rexml (44)
-
rubygems
/ commands / lock _ command (11) -
rubygems
/ security (11) -
rubygems
/ spec _ fetcher (11) - stringio (11)
- timeout (35)
-
webrick
/ httpauth / authenticator (22)
クラス
-
ARGF
. class (9) - BigDecimal (101)
-
DRb
:: DRbUnknown (11) -
Encoding
:: Converter (11) - Exception (168)
- Fiber (15)
-
Gem
:: Commands :: LockCommand (11) -
Gem
:: Security :: Policy (11) -
Gem
:: SpecFetcher (11) - IO (22)
-
JSON
:: State (11) -
MiniTest
:: Unit (2) -
MiniTest
:: Unit :: TestCase (1) -
REXML
:: ParseException (44) - SignalException (55)
- StringIO (11)
- Thread (57)
- TracePoint (22)
モジュール
- Exception2MessageMapper (78)
- FileUtils (22)
- Kernel (194)
-
MiniTest
:: Assertions (1) -
Net
:: HTTPExceptions (11) - Timeout (19)
-
WEBrick
:: HTTPAuth :: Authenticator (11) -
WEBrick
:: HTTPAuth :: ProxyAuthenticator (11)
キーワード
-
$ ! (11) -
$ ERROR _ INFO (11) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - == (11)
- AuthException (22)
- BigDecimal (12)
- Complex (12)
-
EXCEPTION
_ ALL (11) -
EXCEPTION
_ INFINITY (11) -
EXCEPTION
_ NaN (11) -
EXCEPTION
_ OVERFLOW (11) -
EXCEPTION
_ UNDERFLOW (11) -
EXCEPTION
_ ZERODIVIDE (11) - Fail (12)
- Float (6)
- Integer (6)
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 3
. 0 . 0 (4) -
PASSTHROUGH
_ EXCEPTIONS (1) - Raise (12)
- Rational (6)
- Rubyの起動 (3)
- Ruby用語集 (11)
-
abort
_ on _ exception (22) - backtrace (11)
-
backtrace
_ locations (11) - bind (6)
- cause (11)
- complain (11)
- context (11)
- debug (11)
-
def
_ exception (12) -
exception
_ details (1) -
extend
_ object (6) - fail (39)
- generate (11)
-
handle
_ interrupt (11) - inspect (11)
-
json
_ create (11) -
last
_ error (11) - line (11)
- location (1)
- logger (11)
- mode (22)
- new (57)
- position (11)
- puke (1)
- raise (48)
-
raised
_ exception (11) -
read
_ nonblock (31) - remove (11)
-
report
_ on _ exception (16) -
report
_ on _ exception= (8) - response (11)
- rm (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) -
save
_ exception _ mode (11) -
set
_ backtrace (11) - signm (11)
- signo (11)
- spawn (24)
- system (24)
- timeout (35)
-
to
_ json (11) -
to
_ s (22) -
to
_ tty? (7) -
verify
_ gem (11) -
warn
_ legacy (11) -
write
_ nonblock (11) - 制御構造 (11)
検索結果
先頭5件
-
Exception
. exception(error _ message = nil) -> Exception (45775.0) -
例外オブジェクトを生成して返します。
...@param error_message エラーメッセージを表す文字列を指定します。このメッセージは
属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。
//emlist[例][ruby]{
e = Exception.new("some message")
p e......# => #<Exception: some message>
p e.message # => "some message"
//}
//emlist[例][ruby]{
e = Exception.exception("some message")
p e # => #<Exception: some message>
p e.message # => "some message"
//}... -
Exception
# exception(error _ message) -> Exception (45743.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...合は self を返します。引数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラー......メッセージを表す文字列を指定します。
//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
Exception
# exception -> self (45443.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...合は self を返します。引数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラー......メッセージを表す文字列を指定します。
//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
DRb
:: DRbUnknown # exception -> DRb :: DRbUnknownError (30401.0) -
マーシャリングされたオブジェクトが元のオブジェクトに変換できなかった、 ということを意味する例外オブジェクトを返します。
...マーシャリングされたオブジェクトが元のオブジェクトに変換できなかった、
ということを意味する例外オブジェクトを返します。
この例外オブジェクトの DRb::DRbUnknownError#unknown を
呼び出すと、 self が返されます。... -
Exception2MessageMapper
# def _ exception(exception _ name , message _ format , superclass = StandardError) -> Class (27624.0) -
exception_name という名前の例外クラスを定義します。
...
exception_name という名前の例外クラスを定義します。
@param exception_name 定義する例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマット。
@param superclass 定義する例外のスーパークラスを指定......します。
省略すると StandardError を使用します。... -
Exception2MessageMapper
. def _ exception(klass , exception _ name , message _ format , superklass = StandardError) -> Class (27624.0) -
exception_name という名前の例外クラスを定義します。
...
exception_name という名前の例外クラスを定義します。
@param klass 一階層上となるクラス名を指定します。
@param exception_name 例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマットを指定しま......。
Kernel.#sprintf のフォーマット文字列と同じ形式を使用できます。
@param superklass 定義する例外クラスのスーパークラスを指定します。
省略すると StandardError を使用します。
@return 定義した例外... -
Exception
. new(error _ message = nil) -> Exception (27475.0) -
例外オブジェクトを生成して返します。
...@param error_message エラーメッセージを表す文字列を指定します。このメッセージは
属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。
//emlist[例][ruby]{
e = Exception.new("some message")
p e......# => #<Exception: some message>
p e.message # => "some message"
//}
//emlist[例][ruby]{
e = Exception.exception("some message")
p e # => #<Exception: some message>
p e.message # => "some message"
//}... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (24476.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][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:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.......rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Thread
# report _ on _ exception -> bool (21550.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...tderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Threa......op; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x......00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
. report _ on _ exception -> bool (21550.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...err に報告します。
デフォルトは 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 <mai......n>'
1: from -e:1:in `times'
これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:
* 例外が意図し......で rescue して、
その例外でスレッドが終了しないようにするのがより良い方法です。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレ......derr に報告します。
デフォルトは 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 `block in <mai... -
TracePoint
# raised _ exception -> Exception (21508.0) -
発生した例外を返します。
...ise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by 0>
end
trace.enable
begin
0/0
rescue......
end
//}...