Try Catch

You can use this activity for exception handling. This activity works in conjunction with the 'Continue on Error' property of the activities. The 'Try' property in this activity displays an exception when the Continue on Error check box is cleared. The check box is selected, by default.

Property Type Property Name Data Type Description
Try Try N/A Contains a single activity or a sequence that is likely to throw an exception.
Catch Catch N/A One or more exception classes can be added here to identify an exception thrown by the Try property.
Finally Finally N/A One or more activities can be added which runs irrespective of executions of Try and Catch property.

Example:

This example demonstrates an exception that is encountered when working with Web Activities.

  • Specify an invalid XPath in the click activity of the Try property. The activity times out if the specified element is not found. The Continue on Error check box must be cleared for this activity.
  • Select an exception class from the drop down or click the Browse for more option after clicking Add a catch. The exception class is based on the exception that the activity displays.
  • Add an activity or a sequence in the Catch property to decide an action that must be taken when an exception is encountered. Similarly, an activity or a sequence can be added to the Finally property. Anything in the Finally property is executed irrespective of an exception.

On running the RPA flow, an exception is encountered and the Message Box in the Catch property is executed to display the. 'Unexpected Error occurred in Click Activity: Timed out after 30 seconds' message.

To display the exception message, "exception.message" input is provided to the message box.