Project

General

Profile

Actions

Bug #14324

closed

Should Exception#full_message include escape sequences?

Added by Eregon (Benoit Daloze) almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
[ruby-core:84676]

Description

$ ruby -e 'p RuntimeError.new("foo").full_message'
"\e[1mTraceback \e[m(most recent call last):\n-e:1:in `full_message': \e[1mfoo (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"

That is probably not intended.

$ ruby -e 'p RuntimeError.new("foo").full_message' |& cat
"-e:1:in `full_message': foo (RuntimeError)\n"

So Exception#full_message depends if stderr is a tty which seems wrong.
I think it should be the second result, i.e., no escape sequences.


Related issues 2 (1 open1 closed)

Related to Ruby master - Feature #14141: Add a method to Exception for retrieving formatted exception for logging purpose (Exception#{formatted,display})Closedmatz (Yukihiro Matsumoto)Actions
Related to Ruby master - Feature #9918: Exception#cause should be shown in output and #inspectOpenActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0