るりまサーチ (Ruby 2.2.0)

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

Exception#message -> String (78325.0)

エラーメッセージをあらわす文字列を返します。

エラーメッセージをあらわす文字列を返します。

//emlist[例][ruby]{
begin
1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end
//}

Exception#to_s -> String (33025.0)

エラーメッセージをあらわす文字列を返します。

エラーメッセージをあらわす文字列を返します。

//emlist[例][ruby]{
begin
1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end
//}

Exception#exception(error_message) -> Exception (24421.0)

引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。

引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。

Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。

@param error_message エラーメッセージを表す文字列を指定します。

//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogeho...

Thread#raise(error_type, message, traceback) -> () (24325.0)

自身が表すスレッドで強制的に例外を発生させます。

自身が表すスレッドで強制的に例外を発生させます。

@param error_type Kernel.#raise を参照してください。

@param message Kernel.#raise を参照してください。

@param traceback Kernel.#raise を参照してください。

Thread.new {
sleep 1
Thread.main.raise "foobar"
}

begin
sleep
rescue
p $!, $@
end

=> #<RuntimeError: foobar>
[...

Exception#exception -> self (24121.0)

引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。

引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。

Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。

@param error_message エラーメッセージを表す文字列を指定します。

//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogeho...

絞り込み条件を変える

Exception#==(other) -> bool (24106.0)

自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。

自身と指定された other のクラスが同じであり、
message と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。

@param other 自身と比較したいオブジェクトを指定します。
自身と異なるクラスのオブジェクトを指定した場合は
Exception#exception を実行して変換を試みます。

//emlist[例][ruby]{
require "date"
def check_long_month(month)
return if D...

Exception#inspect -> String (24052.0)

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

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

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

SignalException#signm -> String (24052.0)

self.message のエイリアスです。

self.message のエイリアスです。

//emlist[例][ruby]{
begin
Process.kill('HUP', Process.pid)
sleep
rescue SignalException => e
puts e.signm # => SIGHUP
end
//}

SystemCallError#errno -> Integer | nil (24022.0)

レシーバに対応するシステム依存のエラーコードを返します。

レシーバに対応するシステム依存のエラーコードを返します。

エラーコードを渡さない形式で生成した場合は nil を返します。

begin
raise Errno::ENOENT
rescue Errno::ENOENT => err
p err.errno # => 2
p Errno::ENOENT::Errno # => 2
end

begin
raise SystemCallError, 'message'
rescue SystemCallError => err
p err.e...