A step in a robot may generate an error when it is executed. For example, this will happen if the tag finders cannot find the tag to work on, or if the step action generates an error. Test steps may also be configured 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. In this section, you will learn how to do this.
Before we start, note that the error handling behavior that we describe here applies to runtime execution of a robot (i.e. 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 to this 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 "Error Handling" tab in the Step View has two checkboxes for selecting how (and whether) to report the error.
The "API Exception" checkbox specifies whether 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 the
reference documentation for the details when the robot is executed
in other ways.
The "Log as Error" checkbox specifies whether to log the error. Logging happens in different ways depending on whether the robot is run in the Design Studio or in RoboServer, as described in the reference documentation.
Note that the checkboxes may be unchecked or checked, but may also be marked with an asterisk * meaning that they have been explicitly set to a non-default value. This is explained in Show Changes from Default, where it is also shown 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.
The "Then" property defines how and where robot execution continues after an error has been encountered. The possible options are described with examples in the following sections. Detailed descriptions are found in the reference documentation.