Tcl_AllowExceptions(3tcl)
β¨ Tcl_AllowExceptions β¨
okay so bestie, welcome to the Tcl_AllowExceptions(3tcl) page β it's a Tcl library procedure and it's literally about letting your script throw whatever completion code it wants instead of Tcl being like "no π, that's an error now."
πΈ SYNOPSIS πΈ
#include <tcl.h>
Tcl_AllowExceptions(interp)
π ARGUMENTS π
Tcl_Interp *interp(in) β the interpreter where the script is gonna get evaluated, periodt.
π DESCRIPTION π
So here's the vibe. When a script gets evaluated at top-level β meaning like, no other scripts are pending evaluation when you invoke it β and that script finishes with a completion code that is not TCL_OK, not TCL_ERROR, and not TCL_RETURNβ¦ Tcl's default behaviour is to be a little dramatic and convert that whole thing into a TCL_ERROR return, with an appropriate message attached. Not it. π
The specific Tcl script evaluation procedures that do this are:
Tcl_EvalObjExTcl_EvalObjvTcl_EvalTcl_EvalExTcl_GlobalEvalTcl_GlobalEvalObjTcl_VarEval
<bubble>BUT</bubble> β and this is the iconic part β if you call Tcl_AllowExceptions immediately before calling one of those procedures, then arbitrary completion codes are permitted from the script, and they get returned without modification. No conversion, no meddling, no notes. π
This is highkey useful when the caller can actually deal with exceptions like TCL_BREAK or TCL_CONTINUE in a meaningful way β like, the caller knows what to do with them, so let them cook. π₯
π KEYWORDS π
continue, break, exception, interpreter
okay that's the whole page, slay π β this was Tcl 7.4, dated 7.4, filed under Tcl_AllowExceptions(3tcl), and yes the footer says the same thing as the header because that's just how manpages do. no cap. π¦
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 1989-1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms