るりまサーチ

最速Rubyリファレンスマニュアル検索!
236件ヒット [1-100件を表示] (0.207秒)

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. rsa p=
  5. rsa p

検索結果

<< 1 2 3 > >>

Exception#exception(error_message) -> Exception (36444.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 (36244.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
//}...

TracePoint#raised_exception -> Exception (18527.0)

発生した例外を返します。

...生した例外を返します。

@raise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。

//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by...

Fiber#raise(exception, message = nil, backtrace = nil) -> object (18353.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...引数をメッセージとした RuntimeError
が発生します。

その他のケースでは、最初の引数は Exception Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
この場合、2つ目の引数に例...
...@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error...
...!" # => Error! (RuntimeError)
//}

//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end

p
f.resume # => :loop
p
f.raise StopIteration # => :exit
//}...

Fiber#raise -> object (18153.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...引数をメッセージとした RuntimeError
が発生します。

その他のケースでは、最初の引数は Exception Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
この場合、2つ目の引数に例...
...@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error...
...!" # => Error! (RuntimeError)
//}

//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end

p
f.resume # => :loop
p
f.raise StopIteration # => :exit
//}...

絞り込み条件を変える

Fiber#raise(message) -> object (18153.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...引数をメッセージとした RuntimeError
が発生します。

その他のケースでは、最初の引数は Exception Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
この場合、2つ目の引数に例...
...@param message 例外のメッセージとなる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error...
...!" # => Error! (RuntimeError)
//}

//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end

p
f.resume # => :loop
p
f.raise StopIteration # => :exit
//}...

Exception#inspect -> String (15125.0)

self のクラス名と message を文字列にして返します。

...self のクラス名と message を文字列にして返します。

//emlist[例][ruby]{
begin
raise
"exception"
rescue
p
$!.inspect # => "#<RuntimeError: exception>"
end
//}...

Thread#report_on_exception -> bool (12263.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...hread.report_on_exception です。

@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。

//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # =>...
...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:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Th...
...read:0x00007fc3f48aefc0@(irb):4 dead>
//}

@see Thread.report_on_exception...

Thread#report_on_exception=(newstate) (12263.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...hread.report_on_exception です。

@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。

//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # =>...
...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:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Th...
...read:0x00007fc3f48aefc0@(irb):4 dead>
//}

@see Thread.report_on_exception...

Exception#cause -> Exception | nil (12226.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] (12059.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...
<< 1 2 3 > >>