-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
NoMethodError thrown which returns false for error.is_a?(Exception) #3359
Comments
Some more detailed information:
I also updated the example in our repo to print a backtrace of the
Since I'm afraid I didn't make myself clear in the first post: one issue is the "private method" error (not sure if that should be raised or not), but the bigger issue is the fact that the raised error
Hopefully this makes it clearer. Otherwise I'd be happy to provide more details! |
Is it possible that your Exception here ends up referring to java.lang.Exception? You might not notice it if for some reason this context imported java.lang.Exception and was attempting to use it for this case. I will try to reproduce but your example is a bit complicated. |
I don't really know how to use docker and was unable to run your reproduction. I guess I only have a docker "client" installed? Do I need to run your example on Linux or will it work on OS X? Perhaps you can pop by #jruby on Freenode IRC today? |
Moving to 9.0.3 because I don't know how to reproduce yet. |
Ok, after discussion on IRC we determined that both the NoMethodError and the Exception mismatch are probably bugs in Bunny. We recommended that @naag file issues with the Bunny project and link us here. Marking this as invalid. Thanks for helping us investigate, @naag! |
Thanks again @headius and @enebo! Your support on IRC makes me feel all warm and cozy :-) I've now created a PR and an issue over at https://github.com/ruby-amqp/bunny: ruby-amqp/bunny#355 (to check for the right Exception class) |
We have a problem with JRuby 9.0.1.0 on OpenJDK 8 in combination with Bunny gem (v 2.2.0). Due to other issues, JRuby raises a
NoMethodError
when Bunny tries to connect to the RabbitMQ host. For some reason that error returnsfalse
forerror.is_a?(Exception)
and is thus not detected properly by Bunny. The same code works flawlessly on MRI 2.1.6. It seems that there are two distinct classesException
. Should this ever happen?We have built a minimal example for this issue based on Docker, which you can find here: https://github.com/pressrelations/jruby-exceptions.
To run it, just use the following (in case you have Docker installed):
Otherwise,
bundle install
and then runfails.rb
orworks.rb
.works.rb
includes a monkey patch to Bunny which also catchesNoMethodError
specifically and fixes the issue.FYI: There still remains a second issue: why is the error raised in the first place? We're likely going to open a 2nd issue for that on Bunny, but if you have any idea on that, we'd be glad to hear it.
The text was updated successfully, but these errors were encountered: