ライブラリ
- ビルトイン (150)
- bigdecimal (11)
- e2mmap (36)
-
minitest
/ unit (3) - rexml (44)
-
rubygems
/ commands / lock _ command (11) -
rubygems
/ security (11) -
rubygems
/ spec _ fetcher (11) - stringio (11)
- timeout (22)
クラス
-
ARGF
. class (9) - BigDecimal (11)
-
Encoding
:: Converter (11) - Exception (62)
- Fiber (5)
-
Gem
:: Commands :: LockCommand (11) -
Gem
:: Security :: Policy (11) -
Gem
:: SpecFetcher (11) - IO (22)
-
MiniTest
:: Unit (2) -
REXML
:: ParseException (44) - SignalException (22)
- StringIO (11)
- Thread (19)
モジュール
- Exception2MessageMapper (36)
- Kernel (22)
-
MiniTest
:: Assertions (1)
キーワード
- == (11)
- Fail (6)
- Raise (6)
-
abort
_ on _ exception (11) -
backtrace
_ locations (11) - bind (6)
- cause (11)
- complain (11)
- context (11)
-
def
_ exception (6) -
exception
_ details (1) - fail (6)
-
last
_ error (11) - line (11)
- location (1)
- position (11)
- puke (1)
- raise (5)
-
read
_ nonblock (31) -
report
_ on _ exception (8) -
save
_ exception _ mode (11) -
set
_ backtrace (11) - signm (11)
- signo (11)
- timeout (22)
-
to
_ s (11) -
verify
_ gem (11) -
warn
_ legacy (11) -
write
_ nonblock (11)
検索結果
先頭5件
- Exception
# exception -> self - Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] - Exception
# full _ message(highlight: true , order: :bottom) -> String - MiniTest
:: Assertions # exception _ details(exception , message) -> String - Exception2MessageMapper
# def _ exception(exception _ name , message _ format , superclass = StandardError) -> Class
-
Exception
# exception -> self (27232.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@pa......ram error_message エラーメッセージを表す文字列を指定します。
//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (15247.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)......se "#{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... -
Exception
# full _ message(highlight: true , order: :bottom) -> String (15119.0) -
例外の整形された文字列を返します。
...て実際に、キーワード引数 highlight と order は 2.5.1 で追加されました。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。
@...... Exception.to_tty? が真なら :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_mes......sage # => "test.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?......シーケンスによる文字装飾がついています。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。
@param order :top か :bottom で... -
MiniTest
:: Assertions # exception _ details(exception , message) -> String (12309.0) -
与えられた例外の詳細を文字列として返します。
...与えられた例外の詳細を文字列として返します。
@param exception 例外を指定します。
@param message メッセージを指定します。... -
Exception2MessageMapper
# def _ exception(exception _ name , message _ format , superclass = StandardError) -> Class (9425.0) -
exception_name という名前の例外クラスを定義します。
...
exception_name という名前の例外クラスを定義します。
@param exception_name 定義する例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマット。
@param superclass 定義する例外のスーパークラスを指定... -
Exception2MessageMapper
# Fail(exception _ class = nil , *rest) -> () (9227.0) -
登録されている情報を使用して、例外を発生させます。
...param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない場合に発生します。
例:
class Foo
extend Exception2Mess......ageMapper
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)
# という例外が発生します。
Fo......o.Raise Foo::NewExceptionClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
Exception2MessageMapper
# fail(exception _ class = nil , *rest) -> () (9214.0) -
登録されている情報を使用して、例外を発生させます。
...されている情報を使用して、例外を発生させます。
@param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない... -
Exception
# cause -> Exception | nil (9202.0) -
self の前の例外(self が rescue 節や ensure 節の中で発生した例外の場合、 その前に発生していた元々の例外)を返します。存在しない場合は nil を返し ます。
...self の前の例外(self が rescue 節や ensure 節の中で発生した例外の場合、
その前に発生していた元々の例外)を返します。存在しない場合は nil を返し
ます。
//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescu... -
Exception
# ==(other) -> bool (9125.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...い場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。
自身と異なるクラスのオブジェクトを指定した場合は
Exception#exception を実行して変換を試みます。
//emlist[例][ruby]{
req......"
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 }
# =>......esults.map { |e| e.message }
# => ["2 is not long month", "2 is not long month", "4 is not long month"]
# class, message, backtrace が同一のため true になる
p results[0] == results[1] # => true
# class, backtrace が同一だが、message がことなるため false になる
p results... -
BigDecimal
# save _ exception _ mode { . . . } -> object (9102.0) -
例外処理に関する BigDecimal.mode の設定を保存してブロックを評価し ます。ブロック中で変更した設定はブロックの評価後に復元されます。
...例外処理に関する BigDecimal.mode の設定を保存してブロックを評価し
ます。ブロック中で変更した設定はブロックの評価後に復元されます。
ブロックの評価結果を返します。... -
Exception
# set _ backtrace(errinfo) -> nil | String | [String] (9101.0) -
バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。
...に errinfo を設定し、設定されたバックトレース
情報を返します。
@param errinfo nil、String あるいは String の配列のいずれかを指定します。
//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
$!.backtrace # => ["... -
REXML
:: ParseException # line -> Integer (9101.0) -
パースエラーが起きた(XML上の)場所を行数で返します。
...パースエラーが起きた(XML上の)場所を行数で返します。...