[ruby-core:84274] [Ruby trunk Bug#6286] Add Exception#format method

From: eregontp@...
Date: 2017-12-14 19:32:40 UTC
List: ruby-core #84274
Issue #6286 has been updated by Eregon (Benoit Daloze).


Isn't this a duplicate of #14141?

----------------------------------------
Bug #6286: Add Exception#format method
https://bugs.ruby-lang.org/issues/6286#change-68428

* Author: vo.x (Vit Ondruch)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: next minor
* ruby -v: -
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
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

---Files--------------------------------
0001-Feature-6286.patch (11.5 KB)


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

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next