catch(n) Tcl Built-In Commands catch(n) _________________________________________________________________ NAME catch - Evaluate script and trap exceptional returns SYNOPSIS catch _s_c_r_i_p_t ?_v_a_r_N_a_m_e? _________________________________________________________________ DESCRIPTION The catch command may be used to prevent errors from abort- ing command interpretation. Catch calls the Tcl interpreter recursively to execute _s_c_r_i_p_t, and always returns a TCL_OK code, regardless of any errors that might occur while exe- cuting _s_c_r_i_p_t. The return value from catch is a decimal string giving the code returned by the Tcl interpreter after executing _s_c_r_i_p_t. This will be 0 (TCL_OK) if there were no errors in _s_c_r_i_p_t; otherwise it will have a non-zero value corresponding to one of the exceptional return codes (see tcl.h for the definitions of code values). If the _v_a_r_N_a_m_e argument is given, then it gives the name of a variable; catch will set the variable to the string returned from _s_c_r_i_p_t (either a result or an error message). Note that catch catches all exceptions, including those gen- erated by break and continue as well as errors. KEYWORDS catch, error Tcl Last change: 1