Introduction
As discussed in the introduction to this book, I eventually learned the true power of the Tcl shell and how it can be used to locate and diagnose issues within the code. By using the puts
statement I was able to track changes in variables and isolate sections of the code that were presenting issues.
In this chapter we will investigate the commands built into the Tcl shell that allow for more elegant error handling and isolation of sections of code to ensure that they perform correctly before proceeding with a procedure.
Error handling within Tcl allows the developer the freedom to determine how to react to an error. In the following sections we will explore Tcl error handling by implementing these control constructs to illustrate how you can use error handling to proceed with the command without raising an error or returning a Tcl error code. Based on which error handling command you decide to use, you can react accordingly and present the end user with the desired result.
The...