home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / control / error < prev    next >
Encoding:
Text File  |  1993-10-26  |  1.9 KB  |  44 lines  |  [TEXT/$Tcl]

  1.  
  2.           error message ?info? ?code?
  3.  
  4.  
  5.      DESCRIPTION
  6.           Returns a TCL_ERROR code, which causes  command  interpreta-
  7.           tion to be unwound.  Message is a string that is returned to
  8.           the application to indicate what went wrong.
  9.  
  10.           If the info argument is provided and  is  non-empty,  it  is
  11.           used to initialize the global variable errorInfo.  errorInfo
  12.           is used to accumulate a stack trace of what was in  progress
  13.           when  an  error occurred; as nested commands unwind, the Tcl
  14.           interpreter adds information  to  errorInfo.   If  the  info
  15.           argument  is present, it is used to initialize errorInfo and
  16.           the first increment of unwind information will not be  added
  17.           by  the  Tcl  interpreter.  In other words, the command con-
  18.           taining the error command will not appear in  errorInfo;  in
  19.           its place will be info.  This feature is most useful in con-
  20.           junction with the catch command: if a caught error cannot be
  21.           handled  successfully,  info  can  be used to return a stack
  22.           trace reflecting the original point  of  occurrence  of  the
  23.           error:
  24.  
  25.                catch {...} errMsg
  26.                set savedInfo $errorInfo
  27.                ...
  28.                error $errMsg $savedInfo
  29.  
  30.  
  31.           If the code argument is present, then its value is stored in
  32.           the errorCode global variable.  This variable is intended to
  33.           hold a machine-readable description of the  error  in  cases
  34.           where  such information is available; see the section BUILT-
  35.           IN VARIABLES below for information on the proper format  for
  36.           the  variable.   If  the  code argument is not present, then
  37.           errorCode is automatically reset  to  ``NONE''  by  the  Tcl
  38.           interpreter as part of processing the error generated by the
  39.           command.
  40.  
  41.  
  42.      KEYWORDS
  43.           error, errorCode, errorInfo
  44.