fail and raise behave differently #1641

Closed
hadronzoo opened this Issue Apr 17, 2014 · 1 comment

Projects

None yet

3 participants

@hadronzoo

raise works as expected with Java exceptions:

require 'java'
raise Java::JavaLang::Exception.new
# Java::JavaLang::Exception:
#   from sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
#   from #sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
#   ...

However, fail returns a TypeError:

fail Java::JavaLang::Exception.new
# TypeError: exception class/object expected
#   from (irb):6:in `evaluate'
#   from org/jruby/RubyKernel.java:1121:in `eval'
#   from org/jruby/RubyKernel.java:1521:in `loop'
#   from org/jruby/RubyKernel.java:1284:in `catch'
#   from org/jruby/RubyKernel.java:1284:in `catch'
#   from /usr/local/var/rbenv/versions/jruby-1.7.11/bin/irb:13:in `(root)'

Shouldn't fail be synonymous with raise and properly handle Java exceptions?

@lucasallan
Member

@hadronzoo Thanks for report it. raise and fail should have the same behaviour.

@atambo atambo added this to the JRuby 1.7.13 milestone Apr 27, 2014
@atambo atambo self-assigned this Apr 27, 2014
@atambo atambo added a commit to atambo/jruby that referenced this issue Apr 27, 2014
@atambo atambo Kernel#fail should handle java exceptions
Fixes #1641
3a31722
@atambo atambo closed this Apr 27, 2014
@ratnikov ratnikov added a commit to ratnikov/jruby that referenced this issue Jun 13, 2014
@atambo @ratnikov atambo + ratnikov Kernel#fail should handle java exceptions
Fixes #1641
e206511
@ratnikov ratnikov added a commit to ratnikov/jruby that referenced this issue Jun 16, 2014
@atambo @ratnikov atambo + ratnikov Kernel#fail should handle java exceptions
Fixes #1641
7e8c6bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment