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.

Note: 'File not found in the specified directory' is the exception scenario for this flow.

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.

Note: To create the flow, you must install RPA Studio on your machine and set up a connection between the RPA Studio and RPA Management( the on-premis and Multi-Tenant component) by using the connection files from API Gateway. See, Downloading the connection files
  1. 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.
  2. Click New Project. The New Project screen is displayed.
  3. 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.
  4. 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.

  5. Add an If block with exceptionCondition value set as True. The Throw activity is triggered and an exception is thrown.

    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.