RPA flow to use the Throw and Rethrow activities
Create a basic flow to use the Throw and Rethrow activities. This flow also demonstrates handling exceptions using the Try Catch, Throw and Rethrow activities.
Pre-requisites for flow creation
To create this RPA flow, you must ensure:
- An RPA folder is created.
- A .txt file is created within the RPA folder. For example,C:\RPA\Exception_example.txt
Creating a flow
This section lists the steps required to create an RPA flow using the Throw and Rethrow activities.
- Log on to the RPA Studio application. The home page is displayed. Note: The application may prompt you to sign on to a tenant, if not already done.
- Click . The New Project screen is displayed.
- Specify this information in the Properties panel:
- Name
- ThrowRethrow
- ProjectLocation
- Retain the default value
- Description
- Throw and Rethrow
- Language
- VB. This is selected by default.
- Add this sequence.
The sequence includes:
- Try block
Includes the activities or sequences that produce an exception.
- Read Text File and the Message Box
Displays the added contents. At this stage, an exception is produced if the Read Text File does not find a referenced path.
- Throw activity
Stimulates an exception.
- Rethrow activity
Throws an exception that is caught by the Catch activity.
- Try block
- Add an
When an exception is found, the Catch block is triggered. The Catch block includes the Rethrow activity that throws back the exception and terminates the workflow. The exception is displayed in the Error window.
However, if no exception is found, the workflow does not navigate to the Catch block and the flow is terminated.
block with exceptionCondition
value set as True. The Throw activity is triggered and an exception is thrown.