38. Exceptions

Many Tcl commands, such as if and while, have arguments that are Tcl scripts. The C functions for these commands evaluate them recursively to evaluate the scripts. If Tcl_EvalObjEx or any of its related evaluation functions returns a completion code other than TCL_OK, an exception is said to have occurred. Exceptions include TCL_ERROR, which was described in Chapter 31, plus several others that have not been mentioned yet. This chapter introduces the full set of exceptions and describes how to unwind nested evaluations and leave useful information in the errorInfo and errorCode variables.

38.1 Functions Presented in This Chapter

Tcl_AddObjErrorInfo(Tcl_Interp *interp,                char *message, int length)

Adds error text ...

Get Tcl and the Tk Toolkit, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.