Skip to main content

Catch

Sophie avatar
Written by Sophie
Updated over a week ago

Definition and Usage

Defines the block of commands to execute if an error occurs in the preceding Try block. The Catch command works together with the Try command to implement error handling in your RPA workflows. When an error occurs within a Try block, execution jumps to the Catch block where you can implement error handling logic.


Parameter Values

Input parameters

This action does not require any input parameters.

Variables produced

The Catch command captures the error message from the preceding Try block and stores it in a variable.


Using Variables in Conditions

When configuring the Catch command, you can specify a variable name to store the error message. This variable will contain details about the error that occurred in the Try block. You can then use this variable in subsequent commands to:

  • Log the error message for troubleshooting

  • Make decisions based on the error type or content

  • Display the error to the user

  • Send error notifications

Variables are indicated by the {x} icon in the interface and can be referenced in other commands throughout your workflow.


Notes

  • The Catch block must always follow a Try block in your workflow.

  • Multiple Catch blocks can be used to handle different types of errors.

  • If no error occurs in the Try block, the Catch block will be skipped.

  • Consider using Finally blocks after Catch to execute cleanup code regardless of whether an error occurred.

  • The error message stored in the variable contains information about the error type, location, and description.

  • Without proper error handling using Try/Catch blocks, errors might cause your entire workflow to fail.

Did this answer your question?