Handle Errors in Sub-Automations

This section describes handling an error in a sub-automation.

When an error occurs in a sub-automation, you need to manage it properly for the main automation to work well.

The following example shows managing an error in a sub-automation.

  1. Create an automation called Sub automation.

  2. In the automation workflow, drag and drop the Open Workbook activity.

  3. Enable On Error node and then drag and drop the Log Message activity.

  4. Enter Sub automation - Log error in OnError branch in the message field.

  5. Create another automation called Main automation.

  6. In the automation workflow, drag and drop the Sub automation and then drag and drop the Log Message - End activity .

  7. Enter End of automation in the message field.

  8. Enable On Error node and then drag and drop the Log Message activity.

  9. Enter Main automation - Log error in OnError branch in the message field and select the label as error.

  10. Save and execute the Main automation.

   

Result

The error is displayed in the sub automation. As it is not a catch function, the Log Message in the On Error branch in the sub automation is executed and ends with an error. As this error is not caught in the Main Automation, the bot falls into the On Error branch of the Main Automation. The message, End of automation, cannot be displayed as the Log Message – End activity is not executed.

Instead, you should do the following:

  1. Modify “Main Automation” to insert a Try/Catch block. Refer to the below screenshot.

  2. Enter Catch error in the message field.

  3. Save and execute the Main automation.

Result

The error displayed in the sub-automation makes the bot fall into the On Error branch of the Sub Automation. Then it is caught by the Catch block of the Main Automation and the End of Automation message can be displayed.

Related Topic