Project

General

Profile

Actions

Feature #9918

open

Exception#cause should be shown in output and #inspect

Added by Eregon (Benoit Daloze) almost 10 years ago. Updated over 8 years ago.

Status:
Open
Assignee:
-
Target version:
-
[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 2 (1 open1 closed)

Related to Ruby master - Bug #14324: Should Exception#full_message include escape sequences?Closedsorah (Sorah Fukumori)Actions
Has duplicate Ruby master - Feature #11347: Errors with cause not reported properly to consoleOpenActions

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Description updated (diff)
Actions #2

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Has duplicate Feature #11347: Errors with cause not reported properly to console added
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 6 years ago

  • Related to Bug #14324: Should Exception#full_message include escape sequences? added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0