From 19de2a53bd86c22cf7e438c3e85c8affff85f5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Thu, 12 Mar 2026 13:24:30 +0100 Subject: [PATCH] exceptions: make escape signal an exception not internal error --- src/c/error.d | 3 +++ src/c/escape.d | 4 +++- src/h/object.h | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/c/error.d b/src/c/error.d index 2c39f3bfc..82defafcf 100644 --- a/src/c/error.d +++ b/src/c/error.d @@ -137,6 +137,9 @@ ecl_exception_handler(cl_object o) case ECL_EX_F_INVAL: FEinvalid_function(arg1); break; + case ECL_EX_S_FMISS: + FEcontrol_error("UNWIND: frame ~s not found.", 1, arg1); + break; default: ecl_internal_error("Unknown exception type."); } diff --git a/src/c/escape.d b/src/c/escape.d index bf3c6eb3a..cc50d6e4b 100644 --- a/src/c/escape.d +++ b/src/c/escape.d @@ -39,7 +39,9 @@ void ecl_escape(cl_object continuation) { ecl_frame_ptr fr = frs_sch(continuation); - if (!fr) ecl_internal_error("si_fear_handler: continuation not found!"); + if (!fr) { + ecl_ferror(ECL_EX_S_FMISS, continuation, ECL_NIL); + } ecl_unwind(ecl_process_env(), fr); _ecl_unexpected_return(); } diff --git a/src/h/object.h b/src/h/object.h index 38bdc5343..0c460bddf 100644 --- a/src/h/object.h +++ b/src/h/object.h @@ -1017,7 +1017,8 @@ typedef enum { ECL_EX_V_BNAME, /* illegal variable name */ ECL_EX_F_NARGS, /* wrong number of arguments */ ECL_EX_F_UNDEF, /* undefined function */ - ECL_EX_F_INVAL /* non-function passed as function */ + ECL_EX_F_INVAL, /* non-function passed as function */ + ECL_EX_S_FMISS /* missing unwind frame (ecl_escape) */ } ecl_ex_type; #define ECL_EXCEPTIONP(x) ((ECL_IMMEDIATE(x)==0) && ((x)->d.t==t_exception))