Environment Information
Provide at least:
- JRuby version:
jruby 9.2.20.0 (2.5.8) 2021-11-02 1a3255440b OpenJDK 64-Bit Server VM 17.0.6+10-Ubuntu-1ubuntu2 on 17.0.6+10-Ubuntu-1ubuntu2 +jit [linux-x86_64] and jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913fda OpenJDK 64-Bit Server VM 17.0.6+10-Ubuntu-1ubuntu2 on 17.0.6+10-Ubuntu-1ubuntu2 +jit [x86_64-linux]
- Operating system and platform:
Linux pc-ubuntu 6.2.0-20-generic #20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 6 07:48:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
Example code:
begin
raise java.lang.OutOfMemoryError.new("A Java error")
rescue Exception => e
e.is_a?(Exception)
end
- The java error should get rescued and respond to
is_a?(Exception) (the example returns true)
- alternatively (if there is a reason for this): Java-errors do not get rescued and also won't respond to
is_a?(Exception)
Actual Behavior
- The exception gets rescued but does not respond to
is_a?(Exception) (the example returns false)
Additional information
I stumbled upon this working in a JRuby Rails application using sentry-ruby as error notifier. Unfortunately, Sentry does a type check on the rescued exception and won't allow the java error, despite it conforming to the exception interface.
Environment Information
Provide at least:
jruby 9.2.20.0 (2.5.8) 2021-11-02 1a3255440b OpenJDK 64-Bit Server VM 17.0.6+10-Ubuntu-1ubuntu2 on 17.0.6+10-Ubuntu-1ubuntu2 +jit [linux-x86_64]andjruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913fda OpenJDK 64-Bit Server VM 17.0.6+10-Ubuntu-1ubuntu2 on 17.0.6+10-Ubuntu-1ubuntu2 +jit [x86_64-linux]Linux pc-ubuntu 6.2.0-20-generic #20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 6 07:48:48 UTC 2023 x86_64 x86_64 x86_64 GNU/LinuxExpected Behavior
Example code:
is_a?(Exception)(the example returnstrue)is_a?(Exception)Actual Behavior
is_a?(Exception)(the example returnsfalse)Additional information
I stumbled upon this working in a JRuby Rails application using sentry-ruby as error notifier. Unfortunately, Sentry does a type check on the rescued exception and won't allow the java error, despite it conforming to the exception interface.