るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rubygems/defaults ruby_engine
  5. rake ruby

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 >>

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

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

...定します。

//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_backtrace(["dummy1", "dummy2"])
$!.backtrace # => ["dummy1", "dummy2"]
end

//}...

Exception#message -> String (9025.0)

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

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

//emlist[例][ruby]{
begin

1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end

//}...

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

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

...o_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::GeneratorMethod...

Exception#to_s -> String (9025.0)

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

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

//emlist[例][ruby]{
begin

1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end

//}...

TracePoint#raised_exception -> Exception (6239.0)

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

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

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

trace.enable
begin

0/0
rescue
end

//}...

絞り込み条件を変える

Net::HTTPExceptions#response -> Net::HTTPResponse (3025.0)

例外の原因となったレスポンスオブジェクトを返します。

...レスポンスオブジェクトを返します。

//emlist[例][ruby]{
require 'net/http'

uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin

response.value
rescue => e
e.response # => #<Net::HTTPNotFound 404 Not Found readbody=true>
end

//}...

SignalException#signm -> String (3025.0)

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

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

//emlist[例][ruby]{
begin

Process.kill('HUP', Process.pid)
sleep
rescue SignalException => e
puts e.signm # => SIGHUP
end

//}...

SignalException#signo -> Integer (3025.0)

self のシグナル番号を返します。

...self のシグナル番号を返します。

//emlist[例][ruby]{
p Signal.signame(1) # => "HUP"
begin

Process.kill('HUP', Process.pid)
sleep
rescue SignalException => e
p e.signo # => 1
end

//}...
<< < 1 2 >>