summaryrefslogtreecommitdiffstats
path: root/doc/error.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/error.n')
-rw-r--r--doc/error.n24
1 files changed, 15 insertions, 9 deletions
diff --git a/doc/error.n b/doc/error.n
index ff01a6f..c05f8b9 100644
--- a/doc/error.n
+++ b/doc/error.n
@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.TH error n "" Tcl "Tcl Built-In Commands"
.so man.macros
.BS
@@ -28,7 +28,7 @@ the Tcl interpreter adds information to the \fB\-errorinfo\fR
return option. If the \fIinfo\fR argument is present, it is
used to initialize the \fB\-errorinfo\fR return options and
the first increment of unwind information
-will not be added by the Tcl interpreter.
+will not be added by the Tcl interpreter.
In other
words, the command containing the \fBerror\fR command will not appear
in the stack trace; in its place will be \fIinfo\fR.
@@ -37,18 +37,21 @@ with the \fBcatch\fR command:
if a caught error cannot be handled successfully, \fIinfo\fR can be used
to return a stack trace reflecting the original point of occurrence
of the error:
+.PP
.CS
-\fBcatch {...} errMsg
+catch {...} errMsg
set savedInfo $::errorInfo
\&...
-error $errMsg $savedInfo\fR
+\fBerror\fR $errMsg $savedInfo
.CE
+.PP
When working with Tcl 8.5 or later, the following code
should be used instead:
+.PP
.CS
-\fBcatch {...} errMsg options
+catch {...} errMsg options
\&...
-return -options $options $errMsg\fR
+return -options $options $errMsg
.CE
.PP
If the \fIcode\fR argument is present, then its value is stored
@@ -58,15 +61,18 @@ of the error in cases where such information is available; see
the \fBreturn\fR manual page for information on the proper format
for this option's value.
.SH EXAMPLE
+.PP
Generate an error if a basic mathematical operation fails:
+.PP
.CS
if {1+2 != 3} {
\fBerror\fR "something is very wrong with addition"
}
.CE
-
.SH "SEE ALSO"
catch(n), return(n)
-
.SH KEYWORDS
-error
+error, exception
+'\" Local Variables:
+'\" mode: nroff
+'\" End: