Repeat On Error Until True Loop

The Repeat On Error Until True loop allows you to repeat a series of activities when an unhandled error occurs. The activities in the group are executed once. If there are no unhandled errors, the loop terminates. If an error occurs for which there is no error transition, the condition of the loop is evaluated — if the condition is true, the loop terminates, if the condition is false, the loop repeats until there is no error occurs or the condition is true.

For example, you may wish to execute a series of activities and retry the execution in the event of an unhandled error. However, you wish to retry the execution only five times, to avoid an infinite loop if the error occurs repeatedly. In this case, specify a repeat on error until true loop with a condition that terminates the execution after five tries.

The following figure illustrates a repeat on error until true loop.

The process performs the following operations:

Procedure 

  1. An FTP Get activity retrieves a file from an FTP server.

  2. The contents of the file are written so the data is available at a later time.

  3. The contents of the file are sent by email.

The following is the configuration for this example loop:

The condition is specified as $i = 5, which means that when the index variable is equal to five (that is, the fifth iteration of the loop), the loop exits. The condition is only evaluated upon encountering an unhandled error in the group. If an error is encountered, the loop terminates if the condition evaluates to true. The resulting behavior in this example is that the group of activities executes and loops until either a successful completion of all activities, or until the group is executed five times.