Skip to content

Commit 4b04786

Browse files
committed
Don't consider TruffleException as uncaught Java exceptions
* For example, NFIUnsatisfiedLinkError is a TruffleException and is rescued by FFI::Library#ffi_lib.
1 parent 5ed7adc commit 4b04786

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/truffleruby/language/methods/ExceptionTranslatingNode.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.truffleruby.language.methods;
1111

1212
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
13+
import com.oracle.truffle.api.TruffleException;
1314
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
1415
import com.oracle.truffle.api.frame.VirtualFrame;
1516
import com.oracle.truffle.api.nodes.ControlFlowException;
@@ -238,8 +239,10 @@ private DynamicObject translateThrowable(Throwable throwable) {
238239
throw (AssertionError) throwable;
239240
}
240241

242+
final boolean truffleException = throwable instanceof TruffleException;
243+
241244
if (getContext().getOptions().EXCEPTIONS_PRINT_JAVA
242-
|| getContext().getOptions().EXCEPTIONS_PRINT_UNCAUGHT_JAVA) {
245+
|| (!truffleException && getContext().getOptions().EXCEPTIONS_PRINT_UNCAUGHT_JAVA)) {
243246
throwable.printStackTrace();
244247

245248
if (getContext().getOptions().EXCEPTIONS_PRINT_RUBY_FOR_JAVA) {

0 commit comments

Comments
 (0)