`$errorCode`, a [tclvars%|%variable managed by Tcl], contains the value of the `-errorcode` entry in the options dictionary that describes the last error encountered. ** See Also ** [error]: [errorInfo]: [http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/7b1d81ef58925eb1/%|%TIP #287: Add a Commands for Determining Size of Buffered Data], [comp.lang.tcl], 2006-12-14: `$errorCode` is also discussed. ** Description ** `[return]` creates an options dictionary which made available via `[catch]` and `[try]`. For convenience, when the evaluation of a command produces an error code, it is also written to `$::errorCode`. DKF writes in [Interrupting loops]: : The global ''errorCode'' variable is probably the best way to detect what kind of error happened; all too often it is shamefully ignored by the majority of scripts, and yet it is far easier for scripts to handle it than the ''errorInfo'' variable or the message string itself. One way to encourage setting the ''errorCode'' would be to propose additional error classes. The standard ARITH, CHILD*, NONE, and POSIX only cover a fraction of all possible error conditions. <> Tcl syntax | Debugging