るりまサーチ

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

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. openssl n
  3. rsa n
  4. pop n_mails
  5. openssl n=

検索結果

<< 1 2 3 ... > >>

Exception#exception(error_message) -> Exception (33332.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 (33232.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 (15325.0)

exception_name という名前の例外クラスを定義します。

...
exception
_name という名前の例外クラスを定義します。

@param exception_name 定義する例外クラスの名前をシンボルで指定します。

@param message_format メッセージのフォーマット。

@param superclass 定義する例外のスーパークラスを指定...
...します。
省略すると StandardError を使用します。...

Exception#backtrace_locations -> [Thread::Backtrace::Location] (15147.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 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#inspect -> String (15113.0)

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

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

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

Exception#to_json(*args) -> String (15101.0)

自身を JSON 形式の文字列に変換して返します。

...身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡され...
...ます。

//emlist[例][ruby]{
require "json/add/core"

begin
0/0
rescue => e
e.to_json # => "{\"json_class\":\"ZeroDivisionError\",\"m\":\"divided by 0\",\"b\":[\"/path/to/test.rb:4:in `/'\",\"/path/to/test.rb:4:in `<main>'\"]}"
end
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...

TracePoint#raised_exception -> Exception (12409.0)

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

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

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

MiniTest::Assertions#exception_details(exception, message) -> String (12309.0)

与えられた例外の詳細を文字列として返します。

...与えられた例外の詳細を文字列として返します。

@param exception 例外を指定します。

@param message メッセージを指定します。...

Thread#report_on_exception -> bool (12251.0)

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

..._on_exception です。

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

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

@see Thread.report_on_exception...

絞り込み条件を変える

Thread#report_on_exception=(newstate) (12251.0)

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

..._on_exception です。

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

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

@see Thread.report_on_exception...
<< 1 2 3 ... > >>