Throw

This step throws an exception to indicate an error and handle it at another place in the Robot workflow.

When other workflow steps encounter errors, they also throw exceptions. Errors discovered by logic in the workflow and errors discovered by steps are handled in the same way. See Try-Catch for the list of exceptions thrown by other workflow steps. In Throw steps, use the Find Usage option to find an Exception.

Whichever way an exception is thrown, it is caught and handled by the closest Try-Catch containing the specified exception in a Catch branch. If there is no such Try-Catch Step, the exception is set to be "not handled" within the workflow. In that case, execution of the Robot workflow as well the Call Robot step stops, and the error is handled as specified on the Error Handling tab of the Call Robot step.

A typical use of the Throw step is in conjunction with timeout guards. A timeout occurs when an intended interaction with the Device (for example, set by a Location Found guard) is not possible. In some cases when a timeout occurs, it is possible to do something else and thus recover. When recovering is not possible, use the Throw step to communicate the failure in a structured way. This makes it possible to add a Try-Catch to properly handle an error (for example, by backing out of the interaction with the Device).

Using the same exception name for similar errors in different places in the workflow (that is, in different Throw steps) makes it possible to handle all errors in the same Try-Catch step. Therefore, the exception name should provide a classification of the error situation, not all the details.

This step throws an exception and robot execution stops. This step is helpful when designing and debugging your robot. For example, if you want to know when a 60 second timeout guard waits for 60 seconds without any action, insert the Throw step into a timeout guard with a text similar to "60 seconds timeout has passed." If you see your message during the execution, it means the guard waited for 60 seconds and nothing happened.

The Throw step cannot be inserted in the Finally block of the Try-Catch step.

Properties

Name
Contains the name of the step.
Exception
Name of the exception. This name must adhere to the variable name rules. See Naming policy.