Actions
Feature #15458
openAutomatic Exception#cause print in IRB
Status:
Open
Assignee:
-
Target version:
-
Description
According to Ruby 2.6 NEWS, the following feature will be added:
Print cause of the exception if the exception is not caught and printed its backtraces and error message [Feature #8257]
I expected it would be applied in IRB too, but it wasn't. Here is my example:
> begin
> 1/0
> rescue => e
> e.mesage
> end
Traceback (most recent call last):
5: from /Users/jnito/.rbenv/versions/2.6.0-rc1/bin/irb:23:in `<main>'
4: from /Users/jnito/.rbenv/versions/2.6.0-rc1/bin/irb:23:in `load'
3: from /Users/jnito/.rbenv/versions/2.6.0-rc1/lib/ruby/gems/2.6.0/gems/irb-0.9.6/exe/irb:11:in `<top (required)>'
2: from (irb):1
1: from (irb):4:in `rescue in irb_binding'
NoMethodError (undefined method `mesage' for #<ZeroDivisionError: divided by 0>)
Did you mean? message
On the other hand, when I run that code via ruby command, cause of the exception is automatically printed:
$ ruby sample.rb
Traceback (most recent call last):
1: from sample.rb:2:in `<main>'
sample.rb:2:in `/': divided by 0 (ZeroDivisionError)
1: from sample.rb:1:in `<main>'
sample.rb:4:in `rescue in <main>': undefined method `mesage' for #<ZeroDivisionError: divided by 0> (NoMethodError)
Did you mean? message
I feel it would be more natural and useful if the new feature would work in IRB too.
Updated by hsbt (Hiroshi SHIBATA) almost 3 years ago
- Project changed from 14 to Ruby master
Actions
Like0
Like0