aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-11-12 00:33:40 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2025-11-12 00:33:40 +0100
commitbe7c97ce6ae43d677b28d455506fdaedf944a25b (patch)
tree79e32182f6bdd06224ab7438b78d37671a349e94
parentcf2882c2e754f49c46ce2ca12c3ca07e4cabc459 (diff)
execute.c: Report exception also on repeated callback
So far, exceptions coming from the pc callback were only being reported on its first call. However, pc callbacks might assign a continuation callback if the operation cannot be completed on a single call.
-rw-r--r--src/interp/routines/execute.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/interp/routines/execute.c b/src/interp/routines/execute.c
index fe1e8d7..d04363e 100644
--- a/src/interp/routines/execute.c
+++ b/src/interp/routines/execute.c
@@ -33,7 +33,17 @@ static enum nw_state repeat(struct nw_interp *const i)
struct nw_next *const next = &b->next;
const enum nw_state n = next->fn(next->user, next);
- if (n)
+ if (n == NW_FATAL)
+ {
+ static const char *const exc = "pc callback failed";
+
+ i->exception = exc;
+#ifdef NW_LOG
+ nwp_log("%s, pc: %ld\n", exc, b->pc);
+#endif
+ return NW_FATAL;
+ }
+ else if (n)
return n;
return execute(i);