るりまサーチ

最速Rubyリファレンスマニュアル検索!
1392件ヒット [101-200件を表示] (0.122秒)
トップページ > クエリ:i[x] > クエリ:Exception[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. ipaddr to_i
  5. csv to_i

キーワード

検索結果

<< < 1 2 3 4 ... > >>

Exception#cause -> Exception | nil (24201.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.json_create(hash) -> Exception (24201.0)

JSON のオブジェクトから Ruby のオブジェクトを生成して返します。

JSON のオブジェクトから Ruby のオブジェクトを生成して返します。

@param hash 適切なキーを持つハッシュを指定します。

Exception#backtrace -> [String] (24106.0)

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

...rcefile}:#{sourceline}:in `#{method}'"
(メソッド内の場合)
* "#{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#message -> String (24100.0)

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

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

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

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

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

...ds::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::Gener...

絞り込み条件を変える

Exception#to_s -> String (24100.0)

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

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

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

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

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

...した場合は
Exception
#exception を実行して変換を試みます。

//emlist[例][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

results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map { |e| e.message }
# => ["2 is not long month", "2 is not long month", "4 is not long month"]

# class, message, backtrace...

Exception.to_tty? -> bool (24006.0)

$stderr が変更されておらず、$stderr.tty? が真の場合は true を返します。

...$stderr が変更されておらず、$stderr.tty? が真の場合は true を返します。

[注意] 2.5.1 で追加されたメソッドです。

@see Exception#full_message...
...$stderr が変更されておらず、$stderr.tty? が真の場合は true を返します。


@see Exception#full_message...

Gem::Exception (24000.0)

RubyGems で扱う全ての例外のスーパークラスです。

RubyGems で扱う全ての例外のスーパークラスです。

Gem::Security::Exception (24000.0)

セキュリティ関連のエラーを表します。

セキュリティ関連のエラーを表します。

絞り込み条件を変える

<< < 1 2 3 4 ... > >>