-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
When rescuing multiple exceptions, they appear to be evaluated only if needed. For example:
[] ~/projects/rubygems $ ruby -v -e 'begin; raise; rescue StandardError, DumbError; p :here; end'
jruby 9.2.6.0-SNAPSHOT (2.5.3) 2018-12-21 65a4b42 Java HotSpot(TM) 64-Bit Server VM 25.181-b13 on 1.8.0_181-b13 +jit [darwin-x86_64]
NameError: uninitialized constant DumbError
const_missing at org/jruby/RubyModule.java:3536
<main> at -e:1
[] ~/projects/rubygems $ rvm ruby-2.5.3 do ruby -v -e 'begin; raise; rescue StandardError, DumbError; p :here; end'
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
:here
DumbError does not exist, and yet the rescue handles StandardError properly.
I found this attempting to run RubyGems tests; they disable gems and then have a rescue block like this:
begin
gem 'minitest', '~> 5.0'
rescue NoMethodError, Gem::LoadError
# for ruby tests
endWe raise a NameError for the Gem reference here, and MRI does not.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels