1mNAME0m
       error - Generate an error

1mSYNOPSIS0m
       1merror 4m22mmessage24m ?4minfo24m? ?4mcode24m?


1mDESCRIPTION0m
       Returns  a  TCL_ERROR  code,  which causes command interpretation to be
       unwound.  4mMessage24m is a string that is returned to  the  application  to
       indicate what went wrong.

       If  the  4minfo24m argument is provided and is non-empty, it is used to ini-
       tialize the global variable 1merrorInfo22m.  1merrorInfo 22mis used to accumulate
       a stack trace of what was in progress when an error occurred; as nested
       commands unwind, the Tcl interpreter adds information to 1merrorInfo22m.  If
       the  4minfo24m  argument  is present, it is used to initialize 1merrorInfo 22mand
       the first increment of unwind information will not be added by the  Tcl
       interpreter.   In other words, the command containing the 1merror 22mcommand
       will not appear in 1merrorInfo22m; in its place will be 4minfo24m.  This  feature
       is most useful in conjunction with the 1mcatch 22mcommand: if a caught error
       cannot be handled successfully, 4minfo24m can be  used  to  return  a  stack
       trace reflecting the original point of occurrence of the error:
              1mcatch {...} errMsg0m
              1mset savedInfo $errorInfo0m
              1m...0m
              1merror $errMsg $savedInfo0m

       If the 4mcode24m argument is present, then its value is stored in the 1merror-0m
       1mCode 22mglobal variable.  This variable is intended  to  hold  a  machine-
       readable  description  of  the error in cases where such information is
       available; see the 1mtclvars 22mmanual page for information  on  the  proper
       format  for  the  variable.   If the 4mcode24m argument is not present, then
       1merrorCode 22mis automatically reset to ``NONE'' by the Tcl interpreter  as
       part of processing the error generated by the command.


1mSEE ALSO0m
       catch(n), tclvars(n)


1mKEYWORDS0m
