November 1999
Intermediate to advanced
832 pages
19h 28m
English
The error command raises an error condition that terminates a script unless it is trapped with the catch command. The command takes up to three arguments:
error message ?info? ?code?
The message becomes the error message stored in the result variable of the catch command.
If the info argument is provided, then the Tcl interpreter uses this to initialize the errorInfo global variable. That variable is used to collect a stack trace from the point of the error. If the info argument is not provided, then the error command itself is used to initialize the errorInfo trace.
proc foo {} {
error bogus
}
foo
=> bogus
set errorInfo
=> bogus
while executing
"error bogus"
(procedure "foo" line 2)
invoked from within ... |
Read now
Unlock full access