るりまサーチ

最速Rubyリファレンスマニュアル検索!
1326件ヒット [1-100件を表示] (0.096秒)
トップページ > クエリ:a[x] > クエリ:exception[x]

別のキーワード

  1. _builtin to_a
  2. matrix to_a
  3. to_a
  4. dbm to_a
  5. argf.class to_a

キーワード

検索結果

<< 1 2 3 ... > >>

Exception.exception(error_message = nil) -> Exception (27339.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 (27331.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#backtrace_locations -> [Thread::Backtrace::Location] (21446.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...報を返します。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require "date"
def check_long_mon...
...rn 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...

Exception#backtrace -> [String] (21206.0)

バックトレース情報を返します。

...)
* "#{sourcefile}:#{sourceline}"
(トップレベルの場合)

という形式の String の配列です。

//emlist[例][ruby]{
def methd
raise
end

begin
methd
rescue => e
p e.backtrace
end

#=> ["filename.rb:2:in `methd'", "filename.rb:6"]
//}

@see Exception#backtrace_locations...

Exception#set_backtrace(errinfo) -> nil | String | [String] (21200.0)

バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。

...@param errinfo 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_back...
...trace(["dummy1", "dummy2"])
$!.backtrace # => ["dummy1", "dummy2"]
end
//}...

絞り込み条件を変える

WEBrick::HTTPAuth::Authenticator::AuthException -> Class (18200.0)

認証失敗時に発生する例外のクラスです。

認証失敗時に発生する例外のクラスです。

WEBrick::HTTPAuth::ProxyAuthenticator::AuthException -> Class (18200.0)

WEBrick::HTTPStatus::ProxyAuthenticationRequired です。

...WEBrick::HTTPStatus::ProxyAuthenticationRequired です。...

MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS -> [Class] (15300.0)

システム関連の例外のリストです。内部で使用します。

システム関連の例外のリストです。内部で使用します。

BigDecimal::EXCEPTION_ALL -> Integer (15231.0)

BigDecimal の計算において例外を発生させるかどうかを設定、確認する 際の値を返します。

...mal の計算において例外を発生させるかどうかを設定、確認する
際の値を返します。

以下の例外全てが対象です。

* BigDecimal::EXCEPTION_INFINITY
* BigDecimal::EXCEPTION_NaN
* BigDecimal::EXCEPTION_OVERFLOW
* BigDecimal::EXCEPTION_UNDERFLOW
* BigDecima...
...l::EXCEPTION_ZERODIVIDE

BigDecimal.mode の第 1 引数に指定します。...

Exception#cause -> Exception | nil (15201.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
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>