Version 2 of errorInfo

Updated 2002-10-24 16:13:37

http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/tclvars.htm

[Someone want to comment on where this global variable gets set and to what good uses one can put it to?]

RS: Contains the error message and traceback of the last error. Silly example:

 % proc foo {} {bar x}
 % proc bar {input} {grill$input}
 % foo
 invalid command name "grillx"
 % set errorInfo
 invalid command name "grillx"
    while executing
 "_unknown grillx"
    ("eval" body line 1)
    invoked from within
 "eval _unknown $args"
    (procedure "unknown" line 17)
    invoked from within
 "grill$input"
    (procedure "bar" line 1)
    invoked from within
 "bar x"
    (procedure "foo" line 1)
    invoked from within
 "foo"

This tells us that unknown raised the error when trying to resolve grillx, called in bar, called in foo. (It does not tell us that the real bug was a missing space between grill and $input.. that's up to the coder to find out. But the traceback may help to narrow in on the bug, at least).

See also errorCode.


Tcl syntax help