Use the Try Catch component
Catch an error or exception that occurs in a component in an automation and transfer control to the other components within the automation.
Vorbereitungen
Role required: none
Warum und wann dieser Vorgang ausgeführt wird
To configure the properties for the Try Catch component, see Properties of the Try Catch component.
For details on the issues related to the Try Catch component, see KB article KB1123551, KB article KB1123552, and KB article KB1123556.
You can use multiple instances of the Try Catch component in an automation to handle errors from other components along the same execution path. When the Try Catch component catches an error or exception in a component, the automation after the failed component doesn’t execute. The Try Catch component returns the error message and can optionally execute an alternative flow which is connected to its On Error port. If an activity comprising a Try Catch component calls another activity with no Try Catch component along the same execution path and after its Try Catch component, the Try Catch component can catch errors, if any, in the called activity.
The Try Catch component enables you to define which activities run within the exception-handling scope and which run outside it. When an error occurs in a component within the Try scope, the component captures the exception and stops execution of the remaining activities in that path. You can connect an alternative flow to the On Error port to handle the exception. Activities that must run outside the exception-handling scope can be connected to the Finally port.
You can use multiple instances of the Try Catch component in an automation to handle errors from other components along the same execution path. If an activity that contains a Try Catch component calls another activity that doesn’t include the Try Catch component, the Try Catch component in the calling activity can still catch errors from the called activity.
Prozedur
Handling errors while processing an Excel file
An automation uses a Try Catch component when reading data from Excel. If the ReadFromExcel component fails because the file path is empty, the Try Catch component captures the error and displays the error message using a MessageBox. The Finally path then runs and displays the current date and time before the automation ends.