Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Exception#full_message [Bug #14324] #1161

Merged
merged 1 commit into from Aug 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 29 additions & 4 deletions refm/api/src/_builtin/Exception
Expand Up @@ -22,6 +22,18 @@
p e # => #<Exception: some message>
p e.message # => "some message"

#@since 2.5.0
--- to_tty? -> bool

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

#@until 2.6.0
[注意] 2.5.1 で追加されたメソッドです。
#@end

@see [[m:Exception#full_message]]
#@end

== Instance Methods

--- exception -> self
Expand Down Expand Up @@ -195,15 +207,26 @@ self の前の例外(self が rescue 節や ensure 節の中で発生した例

#@end
#@since 2.5.0
--- full_message -> String
--- full_message(highlight: true, order: :bottom) -> String
例外の整形された文字列を返します。

返される文字列は Ruby が捕捉されなかった例外を標準エラー出力に出力するときと
同じ形式です。
そのため、$stderr が変更されておらず、$stderr.tty? が真の場合はエスケープシーケンスによる文字装飾がついています。
そのため、メソッド呼び出し時に $stderr が変更されておらず、$stderr.tty? が真の場合は
エスケープシーケンスによる文字装飾がついています。

#@until 2.6.0
[注意] このメソッドは実験的な機能として提供されています。仕様が変更に
なる可能性があります。
そして実際に、キーワード引数 highlight と order は 2.5.1 で追加されました。
#@end

[注意] このメソッドは実験的な機能として提供されています。仕様が変更にな
る可能性があります。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は [[m:Exception.to_tty?]] の返り値と同じです。

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

#@samplecode 例
begin
Expand All @@ -217,3 +240,5 @@ rescue => e
end
#@end
#@end

@see [[m:Exception.to_tty?]]