Handle Errors
A step in a robot may generate an error when it is executed. For example, this happens if the tag finders cannot find the tag to work on, or if the step generates an error. You can configure test steps to act as if an error occurred if the test fails. The default behavior of a robot is to report and log the error immediately, and to omit execution of the steps beyond the one that failed. However, by configuring the error handling properties of the steps in the robot, you can change this behavior. For example, you can make the robot skip a step that generates an error, or you can make it try alternative branches.
The error handling behavior described in this help system applies to runtime execution of a robot (such as execution in RoboServer or in debug mode), not to the execution in design mode in Design Studio. In design mode, an error is normally reported immediately, and the execution of the subsequent steps is aborted. One exception is when the step is configured to "Ignore and Continue" in case of errors, in which case Design Studio does ignore the error and executes the next step, just as it would during runtime execution.
The following shows how to handle API Exceptions and Logging errors:
-
In the
Step View,
Error Handling tab, select an error handling option.
- Select API Exception to report the error back to the caller of the robot. This is most useful when the robot is executed by a client via one of the APIs and runs in RoboServer. In this case the error is sent back to the caller via the API as a RobotErrorResponse, which causes an exception at the caller side, at least when using the default RQLHandler. See Error Handling for more details when the robot is executed in other ways.
- Select Log as Error to log the error. Logging happens in different ways depending on whether the robot is run in the Design Studio or in RoboServer.
You can select or clear the check boxes, which may be marked with an asterisk * to indicate they are set to a non-default value. For details, see Showing Changes from Default, which explains how to remove the asterisk and revert to the default value. When the default value applies (that is, when no asterisk is present), be aware that the default varies according to how the error is handled.
-
In the
Then field, select an option from the list.
This value defines how and where robot execution continues after an error is encountered. The possible options are described with examples in the following sections. For detailed descriptions, see the Error Handling section.