attribute := expression : RECOVERY(handler [, attempts]) ;
attribute | The name of the Attribute. |
expression | The definition of the attribute. |
handler | The action to run if the expression fails. |
attempts | Optional. The number of times to try before giving up. |
The RECOVERY service executes the handler Attribute when the expression fails then re-runs the attribute. If the attribute still fails after the specified number of attempts, any present FAILURE clause will execute. RECOVERY notionally executes in parallel with the failed return result. This service implicitly causes the attribute to be evaluated at global scope instead of the enclosing scope. Only available if workflow services are turned on (see #OPTION(workflow)).
Example:
DoSomethingToFixIt := TRUE; //some action to repair the input
SPeople := SORT(Person,first_name);
nUniques := DEDUP(sPeople,first_name)
: RECOVERY(DoSomethingToFixIt,2),
FAILURE(Email.simpleSend(SystemsPersonel,SystemsPersonel.email,'ouch.htm'));