info errorstack
Gives the -errorstack of the last error.
info errorstack ?INTERP?
Description
Gives the stack of the last error, as the option -errorstack of catch has it: a list of pairs. The first pair is INNER and the text of the failed command. Then each proc that the error left adds CALL and the words of its call, from the innermost. A catch that runs in the script of uplevel adds UP and the count of the levels of the uplevel.
The only INTERP is an empty string, the current interpreter, and each other name is an error.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| INTERP | interpreter path | the current interpreter | The interpreter: only an empty string. |
Returns
A list of pairs.
Examples
% proc e1 {} {error boom}
> proc e2 {x} {e1}
> catch {e2 7}
> info errorstack
INNER {error boom} CALL e1 CALL {e2 7}
% catch {set nope}; info errorstack
INNER {set nope}
Errors
% info errorstack nope
could not find interpreter "nope"
-errorcode TCL LOOKUP INTERP
% info errorstack a b
wrong # args: should be "info errorstack ?interp?"
-errorcode TCL WRONGARGS
Differences from Tcl
- The first word pair is INNER and the text of the failed command, where Tcl has the words of its bytecode instruction.
- An error that leaves the script of
upleveladds no UP pair. Tcl adds UP for it. info errorstackaccepts no child interpreter.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1