るりまサーチ

最速Rubyリファレンスマニュアル検索!
29件ヒット [1-29件を表示] (0.073秒)
トップページ > クエリ:@[x] > クエリ:String[x] > ライブラリ:ビルトイン[x] > クラス:Exception[x]

別のキーワード

  1. string []=
  2. string []
  3. string slice
  4. string slice!
  5. string gsub

キーワード

検索結果

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

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

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

@
param errinfo nil、String あるいは String の配列のいずれかを指定します。

//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
r...

Exception#full_message(highlight: true, order: :bottom) -> String (122.0)

例外の整形された文字列を返します。

...と order は 2.5.1 で追加されました。

@
param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@
param order :top か :bottom で指定する必...
...バックトレースの一番奥がエラーメッセージの上(top)か下(bottom)かを指定します。
デフォルト値は Exception.to_tty? が真なら :bottom で偽なら :top です。

//emlist[例][ruby]{
begin
raise "test"
rescue => e
p e.full_message # => "\e[1m...
...e[1m)\n\e[m"
$stderr = $stdout
p e.full_message # => "test.rb:2:in `<main>': test (RuntimeError)\n"
$stderr = STDERR
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
end
//}

@
see Exception.to_tty?...
...による文字装飾がついています。


@
param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@
param order :top か :bottom で指定する必...

Exception#backtrace -> [String] (116.0)

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

...)
* "#{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...