Try Catch

The Try control allows you to catch errors raised on specific steps of the workflow and handle them on a side branch of the automation.

How to Manage Errors in an Automation

Prerequisites

You have created one or several automations in the Cloud Studio as described in Create an Automation.

Example

The following use case demonstrates how to manage errors using Try/Catch pattern in the automation workflow.

  1. In your automation, on the right-hand side panel, go to the Tools section and click Controls.

  2. Drag and drop the Try control into the workflow of the automation.

  3. Drag and drop Open Excel Instance into the workflow of the automation.

  4. Drag and drop Open Workbook into the workflow of the automation.

  5. Select the step Open Workbook. The Step details panel appears. Set an input parameter in the workbookPath field.

  6. Drag and drop Set Values (Cells) activity into the workflow of the automation.

  7. Select the step Set Values (Cells). The Step details panel appears.

    Set an input parameter in the values and rangeDefinition fields. Enter a wrong value in the rangeDefinition field: as a result, the automation will fail and an error will be raised.

  8. You can catch the error for entering the wrong value in the rangeDefinition. For that, select the Try control and choose a specific error from the Errors to catch dropdown list.

  9. You can use the Log activity if you want to display the error message at runtime. In the message input parameters of the activity, you have access to the error variable's two properties : the error.code and the error.message. The two properties can be used in the logs and for specific treatments in the automation.