-
Notifications
You must be signed in to change notification settings - Fork 323
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
It is impossible to catch Panics in the GUI #9402
Comments
Added a triage label because while the issue is showing up in the GUI, it likely may be an issue in the runtime. |
I encountered this issue today. In the expression Panic.catch Any (Panic.throw 42) _.payload
I created a test reproducing this issue on the |
The issue might be that we're unwinding too early Lines 254 to 256 in f05997d
|
The instrument converts index 53a716f4fb..6d29469fad 100644
--- engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java
+++ engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java
@@ -20,6 +20,7 @@ import org.enso.interpreter.runtime.EnsoContext;
import org.enso.interpreter.runtime.callable.argument.CallArgumentInfo;
import org.enso.interpreter.runtime.data.atom.AtomNewInstanceNode;
import org.enso.interpreter.runtime.error.PanicException;
+import org.enso.interpreter.runtime.error.PanicSentinel;
import org.enso.interpreter.runtime.state.State;
@BuiltinMethod(
@@ -61,7 +62,11 @@ public abstract class CatchPanicNode extends Node {
@CachedLibrary(limit = "3") InteropLibrary interop) {
try {
// Note [Tail call]
- return thunkExecutorNode.executeThunk(frame, action, state, BaseNode.TailStatus.NOT_TAIL);
+ var ret = thunkExecutorNode.executeThunk(frame, action, state, BaseNode.TailStatus.NOT_TAIL);
+ if (ret instanceof PanicSentinel sentinel) {
+ throw sentinel.getPanic();
+ }
+ return ret;
} catch (PanicException e) {
panicBranchProfile.enter();
Object payload = e.getPayload(); |
Jaroslav Tulach reports a new STANDUP for yesterday (2024-09-26): Progress: .
|
Jaroslav Tulach reports a new STANDUP for yesterday (2024-09-27): Progress: .
|
I would like to be able to catch a panic for example in order to inspect its stack trace.
Ideally, the visualization should allow to show a stack trace for a panic by default, but that's probably another thing.
Expected behaviour
The same operations in the REPL work and allow to catch a Panic:
Uncaught panic
Panic recovered as dataflow error
Caught panic
The text was updated successfully, but these errors were encountered: