Try/Catch/Finally/End Actions

   

 

The Try action, along with the Catch, Finally and End actions provide structured exception handling. They allow you to create localised error handling and resource protection, just as you do in programming languages such as C++, C#, Delphi etc.

 

For each Try action, there should be a matching End Action at the same level. The Try must also have either a Catch Action or a Finally Action as it's next sibling. The actions can be used in the following combinations :

 

1.        Try ... Catch block

 

trycatch_example

 

 

2.        Try ... Finally block

 

tryfinally_example

 

A Finally Action will almost always execute it's child actions, the exception being if there is a structural error with the try or catch (ie. a missing end, or finally before catch etc).

 

 

3.        Try ... Catch ... Finally block

 

raiseexception

 

 

A more complete example:

 

tryexample

 

 

Retrying Try Actions

 

All actions have the option to retry multiple times before failing outright. Try action retries work differently to normal action retries. If you set a number of Retry Attempts on a Try action, the entire try block (ie all of the child actions) will be retried if one of the actions from that block fails.

 

tryaction_retry

 

The Catch (or Finally) section of the Try/Catch/Finally will not be run until all the retries have failed.

 

Warning: Retrying Try Actions may give unpredictable behaviour when used inside Async Action Groups. Specifically, retries will be unpredictable if multiple action lists are running concurrently. If you are running Try blocks inside concurrent action lists (ie the same Try block in the same action list being run multiple times), then the Try block will be retried an unpredictable number of times. See Known Problems for details.