Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fail and raise behave differently #1641

Closed
hadronzoo opened this Issue · 1 comment

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
Collaborator

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

@atambo atambo added this to the JRuby 1.7.13 milestone
@atambo atambo self-assigned this
@atambo atambo referenced this issue from a commit in atambo/jruby
@atambo atambo Kernel#fail should handle java exceptions
Fixes #1641
3a31722
@atambo atambo closed this
@ratnikov ratnikov referenced this issue from a commit in ratnikov/jruby
@atambo atambo Kernel#fail should handle java exceptions
Fixes #1641
e206511
@ratnikov ratnikov referenced this issue from a commit in ratnikov/jruby
@atambo atambo 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
Something went wrong with that request. Please try again.