ライブラリ
- English (12)
- ビルトイン (441)
- bigdecimal (38)
- e2mmap (42)
- irb (12)
-
rubygems
/ commands / lock _ command (12) -
rubygems
/ gem _ openssl (12) -
rubygems
/ security (24) - stringio (12)
クラス
- BigDecimal (24)
- Exception (104)
- Fiber (18)
-
Gem
:: Commands :: LockCommand (12) -
Gem
:: Security :: Policy (12) - IO (24)
- StringIO (12)
- Thread (48)
- TracePoint (24)
モジュール
- Exception2MessageMapper (36)
- Gem (12)
-
Gem
:: Security (12) - IRB (12)
- Kernel (225)
キーワード
-
$ ! (12) -
$ ERROR _ INFO (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (12)
- BigDecimal (14)
- Complex (14)
- ErrNotRegisteredException (6)
- Fail (12)
- Float (7)
- Integer (7)
-
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (5) - Rational (7)
- Rubyの起動 (4)
- Thread (12)
- TracePoint (12)
- abort (24)
- backtrace (12)
-
backtrace
_ locations (12) - cause (12)
- complain (12)
-
ensure
_ ssl _ available (12) - fail (42)
-
handle
_ interrupt (12) - inspect (12)
-
irb
_ abort (12) - mode (24)
-
net
/ http (12) - new (12)
- raise (54)
-
raised
_ exception (12) -
read
_ nonblock (24) -
report
_ on _ exception (18) -
report
_ on _ exception= (18) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) -
set
_ backtrace (12) - spawn (28)
- system (28)
-
verify
_ gem (12) -
verify
_ trust _ dir (12) -
write
_ nonblock (12) - スレッド (12)
- 制御構造 (12)
検索結果
先頭5件
-
Exception
# exception(error _ message) -> Exception (27243.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...lf を返します。引数を指定した場合 自身のコピー
を生成し 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 (27143.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...lf を返します。引数を指定した場合 自身のコピー
を生成し 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
//}... -
Exception2MessageMapper
# Raise(exception _ class = nil , *rest) -> () (18257.0) -
登録されている情報を使用して、例外を発生させます。
...param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない場合に発生します。
例:
class Foo
extend Exception2Mess......p def_exception :NewExceptionClass, "message...%d, %d and %d" # =>
def foo
Raise NewExceptionClass, 1, 2, 3
end
end
Foo.new().foo() #=> in `Raise': message...1, 2 and 3 (Foo::NewExceptionClass)
# という例外が発生します。
Foo.Raise Foo::......NewExceptionClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
Exception2MessageMapper
. Raise(klass = E2MM , exception _ class = nil , *rest) -> () (18221.0) -
登録されている情報を使用して、例外を発生させます。
...@param klass 一階層上となるクラス名を指定します。
@param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない... -
TracePoint
# raised _ exception -> Exception (12326.0) -
発生した例外を返します。
...生した例外を返します。
@raise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by... -
Exception
# cause -> Exception | nil (9113.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
//}... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9052.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...バックトレース情報を返します。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require......y == 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'", "t......est.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Exception2MessageMapper
:: ErrNotRegisteredException (9032.0) -
登録されていない例外が Exception2MessageMapper#Raise で使用された場合に発生します。
...登録されていない例外が Exception2MessageMapper#Raise で使用された場合に発生します。... -
Exception
# ==(other) -> bool (9030.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...トを指定した場合は
Exception#exception を実行して変換を試みます。
//emlist[例][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
results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map { |e| e.message }
# => ["2 is not long month", "2 is not long month", "4 is not long month"]
# class, mess... -
Exception
# full _ message(highlight: true , order: :bottom) -> String (9024.0) -
例外の整形された文字列を返します。
...値は Exception.to_tty? の返り値と同じです。
@param order :top か :bottom で指定する必要があります。
バックトレースの一番奥がエラーメッセージの上(top)か下(bottom)かを指定します。
デフォルト値は Exception.to_tt......y? が真なら :bottom で偽なら :top です。
//emlist[例][ruby]{
begin
raise "test"
rescue => e
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
$stderr = $stdout
p e.full_message # => "tes......t.rb:2:in `<main>': test (RuntimeError)\n"
$stderr = STDERR
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
end
//}
@see Exception.to_tty?... -
Exception
# inspect -> String (9018.0) -
self のクラス名と message を文字列にして返します。
...self のクラス名と message を文字列にして返します。
//emlist[例][ruby]{
begin
raise "exception"
rescue
p $!.inspect # => "#<RuntimeError: exception>"
end
//}...