Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail and raise behave differently #1641

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

Comments

Projects
None yet
3 participants
@hadronzoo
Copy link

commented Apr 17, 2014

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?

@sh286

This comment has been minimized.

Copy link
Member

commented Apr 20, 2014

@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 added a commit to atambo/jruby that referenced this issue Apr 27, 2014

@atambo atambo closed this Apr 27, 2014

ratnikov added a commit to ratnikov/jruby that referenced this issue Jun 13, 2014

ratnikov added a commit to ratnikov/jruby that referenced this issue Jun 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.