This manual page is for Mac OS X version 10.6.3

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • For more information about the manual page format, see the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Reference Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.



error(n)                                    Tcl Built-In Commands                                   error(n)



____________________________________________________________________________________________________________

NAME
       error - Generate an error

SYNOPSIS
       error message ?info? ?code?
____________________________________________________________________________________________________________


DESCRIPTION
       Returns  a  TCL_ERROR  code,  which causes command interpretation to be unwound.  Message is a string
       that is returned to the application to indicate what went wrong.

       The -errorinfo return option of an interpreter is 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
       the -errorinfo return option.  If the info argument is present, it is used to initialize the  -error-info -errorinfo
       info return options and the first increment of unwind information will not be added by the Tcl inter-preter. interpreter.
       preter.  In other words, the command containing the error command will not appear in the stack trace;
       in  its  place will be info.  Historically, this feature had been most useful in conjunction with the
       catch command: if a caught error cannot be handled successfully, info can be used to return  a  stack
       trace reflecting the original point of occurrence of the error:
              catch {...} errMsg
              set savedInfo $::errorInfo
              ...
              error $errMsg $savedInfo
       When working with Tcl 8.5 or later, the following code should be used instead:
              catch {...} errMsg options
              ...
              return -options $options $errMsg

       If  the  code  argument  is  present,  then its value is stored in the -errorcode return option.  The
       -errorcode return option is intended to hold a machine-readable description of  the  error  in  cases
       where  such information is available; see the return manual page for information on the proper format
       for this option's value.

EXAMPLE
       Generate an error if a basic mathematical operation fails:
              if {1+2 != 3} {
                  error "something is very wrong with addition"
              }


SEE ALSO
       catch(n), return(n)


KEYWORDS
       error



Tcl                                                                                                 error(n)

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation to the Tcl project.
Bug reports
Report bugs in the functionality of the described tool or API to Apple through Bug Reporter and to the Tcl project through their bug reporting page.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.

Did this document help you? Yes It's good, but... Not helpful...