ライブラリ
- ビルトイン (270)
- bigdecimal (12)
- drb (12)
- e2mmap (36)
- json (12)
-
json
/ add / exception (12) -
minitest
/ unit (3) -
net
/ http (12) - rexml (48)
-
rubygems
/ security (12) -
rubygems
/ spec _ fetcher (12) - stringio (12)
- timeout (16)
クラス
-
ARGF
. class (10) - BigDecimal (12)
-
DRb
:: DRbUnknown (12) -
Encoding
:: Converter (12) - Exception (140)
- Fiber (18)
-
Gem
:: Security :: Policy (12) -
Gem
:: SpecFetcher (12) - IO (24)
-
JSON
:: State (12) -
MiniTest
:: Unit (2) -
REXML
:: ParseException (48) - SignalException (24)
- StringIO (12)
- Thread (42)
- TracePoint (12)
モジュール
- Exception2MessageMapper (36)
- Kernel (16)
-
MiniTest
:: Assertions (1) -
Net
:: HTTPExceptions (12)
キーワード
- == (12)
- Fail (6)
- Raise (6)
-
abort
_ on _ exception (12) -
abort
_ on _ exception= (12) - backtrace (12)
-
backtrace
_ locations (12) - bind (6)
- cause (12)
- context (12)
-
def
_ exception (6) -
exception
_ details (1) - fail (6)
- generate (12)
- inspect (12)
-
last
_ error (12) - line (12)
- location (1)
- position (12)
- puke (1)
- raise (18)
-
raised
_ exception (12) -
read
_ nonblock (34) -
report
_ on _ exception (9) -
report
_ on _ exception= (9) - response (12)
-
save
_ exception _ mode (12) -
set
_ backtrace (12) - signm (12)
- signo (12)
- timeout (16)
-
to
_ json (12) -
to
_ s (24) -
verify
_ gem (12) -
warn
_ legacy (12) -
write
_ nonblock (12)
検索結果
先頭5件
-
Exception
# exception(error _ message) -> Exception (36432.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...を生成し 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 (36232.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...を生成し 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 (24202.0) -
マーシャリングされたオブジェクトが元のオブジェクトに変換できなかった、 ということを意味する例外オブジェクトを返します。
マーシャリングされたオブジェクトが元のオブジェクトに変換できなかった、
ということを意味する例外オブジェクトを返します。
この例外オブジェクトの DRb::DRbUnknownError#unknown を
呼び出すと、 self が返されます。 -
Exception2MessageMapper
# def _ exception(exception _ name , message _ format , superclass = StandardError) -> Class (18425.0) -
exception_name という名前の例外クラスを定義します。
...
exception_name という名前の例外クラスを定義します。
@param exception_name 定義する例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマット。
@param superclass 定義する例外のスーパークラスを指定......します。
省略すると StandardError を使用します。... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (18247.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......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... -
Exception
# backtrace -> [String] (15207.0) -
バックトレース情報を返します。
...line}:in `#{method}'"
(メソッド内の場合)
* "#{sourcefile}:#{sourceline}"
(トップレベルの場合)
という形式の String の配列です。
//emlist[例][ruby]{
def methd
raise
end
begin
methd
rescue => e
p e.backtrace
end
#=> ["filename.rb:2:in `methd'", "filenam......e.rb:6"]
//}
@see Exception#backtrace_locations... -
Exception
# inspect -> String (15113.0) -
self のクラス名と message を文字列にして返します。
...self のクラス名と message を文字列にして返します。
//emlist[例][ruby]{
begin
raise "exception"
rescue
p $!.inspect # => "#<RuntimeError: exception>"
end
//}... -
Exception
# to _ s -> String (15107.0) -
エラーメッセージをあらわす文字列を返します。
...エラーメッセージをあらわす文字列を返します。
//emlist[例][ruby]{
begin
1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end
//}... -
Exception
# set _ backtrace(errinfo) -> nil | String | [String] (15101.0) -
バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。
...nfo nil、String あるいは String の配列のいずれかを指定します。
//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
$!.backtrace # => ["/path/to/test.rb:5:in `rescue in <main>'", "/path/to/test.rb:2:in `<main>'"]
$!.set_backtrace(["dum......my1", "dummy2"])
$!.backtrace # => ["dummy1", "dummy2"]
end
//}...