error(8,n)(n) Tcl Built-In Commands error(8,n)(n) NAME error(8,n) - Generate an error(8,n) SYNOPSIS error(8,n) message ?info(1,5,n)? ?code? DESCRIPTION Returns a TCL_ERROR code, which causes command interpretation to be unwound. Message is a string(3,n) that is returned to the application to indicate what went wrong. If the info(1,5,n) argument is provided and is non-empty, it is used to ini- tialize the global variable errorInfo. errorInfo is used to accumulate a stack trace(3x,n,3x _nc_tracebits) of what was in(1,8) progress when an error(8,n) occurred; as nested commands unwind, the Tcl interpreter adds information to errorInfo. If the info(1,5,n) argument is present, it is used to initialize errorInfo and the first increment of unwind information will not be added by the Tcl interpreter. In other words, the command containing the error(8,n) command will not appear in(1,8) errorInfo; in(1,8) its place will be info(1,5,n). This feature is most useful in(1,8) conjunction with the catch command: if(3,n) a caught error(8,n) cannot be handled successfully, info(1,5,n) can be used to return a stack trace(3x,n,3x _nc_tracebits) reflecting the original point of occurrence of the error: catch {...} errMsg set(7,n,1 builtins) savedInfo $errorInfo ... error(8,n) $errMsg $savedInfo If the code argument is present, then its value is stored in(1,8) the error- Code global variable. This variable is intended to hold a machine- readable description of the error(8,n) in(1,8) cases where such information is available; see the tclvars manual page for information on the proper format for the variable. If the code argument is not present, then errorCode is automatically reset(1,7,1 tput) to ``NONE'' by the Tcl interpreter as part of processing the error(8,n) generated by the command. SEE ALSO catch(n), tclvars(n) KEYWORDS error(8,n), errorCode, errorInfo Tcl error(8,n)(n)