<< Click to Display Table of Contents >> Navigation: Several practical recommendations > Errors handling |
If there is an error occurs in any step during a task, RoboTask records an error message to the task log and stops the task by default. You can change this behavior. To do it, you should select the "Advanced" tab in the task editor and set the "If Error Occurred" parameter to "Continue Execution". In this case, the task will not be stopped in case of an error.
The system variable {IsError} is used to analyze if there was an error in the previous step. This variable contains "True" if there was an error in the previous step and "False" if there was no error in the previous step.
Another method of the error handling is the starting up of another task when an error is raised. For this purpose you need to tune the task like this:
•Open task editor and go to the tab "Advanced"
•Choose the point "Run the Error Handling Task" of parameter "If Error Occurred"
•Choose the task in a drop-down list "Error Handling Task".
If an error was raised in any step when you perform the task, RoboTask starts up the handler-task and stops the main task. At the start of the error handler RoboTask passes the next parameters:
•LastErrorTaskID – the internal ID of the task, in which an error was raised. It is a formal identifier of the task like a number.
•LastErrorTaskName - the name of the task, in which an error was raised.
•LastErrorTaskExternalName – an External Name of the task, in which an error was raised.
•LastErrorStep – the number of the step (starting from 1), in which an error was raised.
•LastErrorCode – code of the error. There is the own kit of codes of errors for any type of actions (see description of actions). By default – 0.
•LastErrorDescription – the description of the error. It depends on a type of action. By default, it is the line "General error".
This set of parameters is enough to definitely identify the error and to undertake any actions.
For example:
•Send an email message with the notice and description of error;
•Make an record into text log file;
and etc.
The variables LastErrorCode and LastErrorDescription can be used in the task in which the error occurred.
The conditions of the using are similar to the variable IsError: it is necessary to set the parameter If Error Occurred into the value Continue Execution, to not interrupt the performing of the task when an error appears.
Related Topics