catch
catch script ?resultVarName? ?optionVarName?
Runs the script and gives its return code: 0 for a result, 1 for an error, 2 for return, 3 for break, and 4 for continue. resultVarName gets the result or the message, and optionVarName gets the options dict with -errorcode and -errorinfo. The error of the compute limit goes through catch.
Examples
A click on an example runs it in the shell of the page.
catch {expr {1 / 0}} msg:1catch {expr {1 / 0}} msg opts; dict get $opts -errorcode:ARITH DIVZERO {divide by zero}
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.