Kernel#raise does not re-raise the correct exception
Reported by Brian Ford | May 21st, 2008 @ 01:13 PM | in 1.0 preview
This could be a blocker for rails code and we now have a spec for it:
$ bin/mspec spec/frozen/1.8/language/raise_spec.rb
..F
1)
Kernel#raise inside a rescue block ignores inner exceptions FAILED
Expected RuntimeError (This exception is re-raised)
but got RuntimeError (No current exception)
Expectation.fail_with at /Users/brian/devel/rubinius/mspec/lib/mspec/expectations/expectations.rb:10
Object(Proc::Function)#should at /Users/brian/devel/rubinius/mspec/lib/mspec/expectations/should.rb:6
Module#__script__ {} at ./spec/frozen/1.8/language/raise_spec.rb:28
Kernel(Module)#instance_eval at kernel/core/eval.rb:134
MSpec.protect at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/mspec.rb:124
RunState#protect {} at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/state.rb:46
Array#each at kernel/core/array.rb:572
RunState#protect at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/state.rb:46
RunState#process {} at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/state.rb:64
Array#each at kernel/core/array.rb:572
RunState#process at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/state.rb:68
MSpec.describe at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/mspec.rb:29
Object#describe at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/object.rb:11
Object#__script__ at ./spec/frozen/1.8/language/raise_spec.rb:16
CompiledMethod#as_script at kernel/core/compiled_method.rb:359
Compile.single_load at kernel/core/compile.rb:247
Compile.unified_load {} at kernel/core/compile.rb:160
Array#each at kernel/core/array.rb:572
Compile.unified_load at kernel/core/compile.rb:126
Kernel.load at kernel/core/compile.rb:404
MSpec.files {} at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/mspec.rb:45
Kernel(Module)#instance_eval at kernel/core/eval.rb:134
MSpec.protect at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/mspec.rb:120
MSpec.files {} at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/mspec.rb:46
Array#each at kernel/core/array.rb:572
MSpec.files at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/mspec.rb:42
MSpec.process at /Users/brian/devel/rubinius/mspec/lib/mspec/runner/mspec.rb:35
MSpecRun#run at /Users/brian/devel/rubinius/mspec/bin/mspec-run:76
MSpecRun.main at /Users/brian/devel/rubinius/mspec/lib/mspec/utils/script.rb:75
Object#__script__ at /Users/brian/devel/rubinius/mspec/bin/mspec-run:83
CompiledMethod#as_script at kernel/core/compiled_method.rb:359
Compile.single_load at kernel/core/compile.rb:247
Compile.load_from_extension at kernel/core/compile.rb:324
Object#__script__ at kernel/loader.rb:204
Finished in 0.064331 seconds
1 file, 3 examples, 4 expectations, 1 failure, 0 errors
Comments and changes to this ticket
-
Ryan Mulligan May 21st, 2008 @ 09:36 PM
I've been looking closely at this and it turns out the problem is that $! is not behaving like a stack, it is getting erased when the inner rescue is being called.
-
Ryan Davis June 23rd, 2008 @ 04:12 PM
- → Assigned user changed from to Wilson Bilkovich
-
Charles Comstock November 24th, 2008 @ 06:59 PM
- → Tag changed from to bug rails spec
- → State changed from new to resolved
This was fixed, we now pass all language/raise specs
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
