summaryrefslogtreecommitdiffstats
path: root/doc/error.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/error.n')
-rw-r--r--doc/error.n20
1 files changed, 13 insertions, 7 deletions
diff --git a/doc/error.n b/doc/error.n
index ff01a6f..a95c691 100644
--- a/doc/error.n
+++ b/doc/error.n
@@ -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: