Skip to content

Commit

Permalink
Filling in stack trace when PanicException is caught fixes the test
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jan 9, 2025
1 parent c33d647 commit 0393b22
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.enso.interpreter.node.expression.builtin.error;

import com.oracle.truffle.api.TruffleStackTrace;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.exception.AbstractTruffleException;
Expand Down Expand Up @@ -89,6 +90,12 @@ private Object executeCallbackOrRethrow(
if (profile.profile(isValueOfTypeNode.execute(panicType, payload, true))) {
var builtins = EnsoContext.get(this).getBuiltins();
var cons = builtins.caughtPanic().getUniqueConstructor();
// if (originalException instanceof PanicException panic) {
// panic.caughtBy(this);
// } else
{
TruffleStackTrace.fillIn(originalException);
}
var caughtPanic =
AtomNewInstanceNode.getUncached().newInstance(cons, payload, originalException);
return invokeCallableNode.execute(handler, frame, state, new Object[] {caughtPanic});
Expand Down

0 comments on commit 0393b22

Please sign in to comment.