Issue #6286 has been updated by mame (Yusuke Endoh).

Assignee changed from mame (Yusuke Endoh) to matz (Yukihiro Matsumoto)
Target version changed from 2.0.0 to next minor

ko1 (Koichi Sasada) wrote:
> mame-san, could you check it?

Looks too specific to include it in core...
At least, it is not a urgent need, I think.

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Bug #6286: Add Exception#format method
https://bugs.ruby-lang.org/issues/6286#change-31787

Author: vo.x (Vit Ondruch)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor
ruby -v: -


It would be nice if Exception class could be extended by #format method (or method with some more suitable name), which would provide the same formatting as is standard output of Ruby exception, e.g. 

boomtest.rb:18:in `go': boom (RuntimeError)
  from boomtest.rb:34:in `foo'
  from boomtest.rb:36

Currently, this formatting is done by error_print function from eval_error.c. Unfortunately this method is just Ruby's internal.

Please note that there exists exception_string gem, which add similar method [1] to the Exception class.


[1] https://github.com/raggi/exception_string/blob/master/lib/exception_string.rb#L15-19


-- 
http://bugs.ruby-lang.org/