::wyrm::try script recoveries
recoveries ::= recovery | recoveries recovery
recovery ::= {selectors} script
selectors ::= selector | selectors selector
selector ::= return-selector | catch
return-selector ::= * | okay [ :glob-pattern ] | error [ :glob-pattern ] | return [ :glob-pattern ] | continue | break | reset
The first script is evaluated and its return code is saved in local variable rc, the result string as rs, the error information (if an error) in ei, and the error code (if an error) in ec. Then the recoveries are examined in order.
If any of return-selector matches the value of $rc and if the optional glob-pattern matches the $rs (* matches any value of $rc), then the script in the recovery is evaluated. If the catch was included in the selectors the result of the script is ignored; otherwise unless the script returns a TCL_OK result, that becomes the result of the try-command and subsequent recovery is stopped. (If the recovery does a return without a catch selector it will stop the try-command.)
If reset is specified and the body is selected, the overall return code is cleared to TCL_OK.
If more than recovery can match the results, each is evaluated until the try-command is stopped or the recoveries are exhausted.
If the try-command is stopped, that is its result. Otherwise the first results are the results.