Project

General

Profile

Feature #9918

Exception#cause should be shown in output and #inspect

Added by Benoit Daloze over 2 years ago. Updated about 1 year ago.

Status:
Open
Priority:
Normal
Assignee:
-
[ruby-core:62984]

Description

Exception#cause has been added in Feature #8257.
But the cause is never shown, one needs to inspect exc.cause to know the cause.

The cause should be shown by default, for instance:

begin
  raise "cause"
rescue
  raise "wrapper"
end

Should output:

-:4:in `rescue in <main>': wrapper (RuntimeError)
       from -:1:in `<main>'
Caused by:
-e:1:in `<main>': org (RuntimeError)

And not only the first 2 lines.
Logically, #inspect should also include the cause such as:

#<RuntimeError: wrapper cause:#<RuntimeError: org>>

What do you think?


Related issues

Duplicated by Ruby trunk - Feature #11347: Errors with cause not reported properly to console Open

History

#1 [ruby-core:69957] Updated by Nobuyoshi Nakada about 1 year ago

  • Description updated (diff)

#2 Updated by Nobuyoshi Nakada about 1 year ago

  • Duplicated by Feature #11347: Errors with cause not reported properly to console added

Also available in: Atom PDF