From: nobu@... Date: 2018-04-17T14:11:04+00:00 Subject: [ruby-core:86559] [Ruby trunk Feature#14684] IRB swallows exceptions Issue #14684 has been updated by nobu (Nobuyoshi Nakada). I changed the tracker to "Feature", as I thought it would not need to backport. But branch maintainers may have different opinion. It seems easy to apply the commits to the old branches. ---------------------------------------- Feature #14684: IRB swallows exceptions https://bugs.ruby-lang.org/issues/14684#change-71501 * Author: RubyBugs (A Nonymous) * Status: Closed * Priority: Normal * Assignee: keiju (Keiju Ishitsuka) * Target version: ---------------------------------------- # Summary IRB swallows exceptions, doesn't provide programatic access to raised exception in session. ## Details On Ruby 2.3.4, we find it surprising that exceptions in IRB are swallowed, and are not accessible at the two locations we checked: 1. In the global variable for most recent exception `$!` 2. In the return value of evaluating the expression `_` Consider this IRB session: ~~~ ruby def method_which_raises 1/0 end method_which_raises # ZeroDivisionError: divided by 0 # from (irb):10:in `/' # from (irb):10:in `method_which_raises' # from (irb):13 # from /Users/marcsiegel/.rubies/ruby-2.3.4/bin/irb:11:in `
' ~~~ ### Observed Neither `_` nor `$!` give access to the raised exception, so that during development or debugging, one could dig further into what had occurred. ### Expected Either `_` or `$!` would give programmatic access in IRB to an exception -- https://bugs.ruby-lang.org/ Unsubscribe: