AWE provides a variety of ways to automatically respond to errors in task steps. These errors can include files or windows not being found at runtime and other more subtle, unexpected conditions that can cause a step to fail.
Step level error handling can be set in the properties dialog box of an action. Every action in the available actions library contains two special tabs related to error handling, Error Causes and On Error.
The Error Causes properties allow selection of specific types of errors that will cause the step to fail. The default behavior is to monitor for all errors, however, the properties can be set in order for the step to ignore certain errors or only react to specific errors.
The On Error tab is used to designate how AWE should respond to an error. The default behavior is that task execution stops in the immediate step that encounters the error, however, properties can be set to continue to the next step in spite of the error. An assortment of other on error options can be chosen as well (i.e. send email, play a sound, write to log, set variable, etc.).
The Error Causes tab allows the task developer to determine what conditions AWE should consider an error for each step. During task execution, if one of these conditions is met, the specified actions in the On Error tab are carried out. (Properties are illustrated below).
The following problems should cause this step to error—Allows selection of specific types of errors that will cause the step to fail. The default behavior is to monitor for all errors, however, the properties can be set in order for the step to ignore certain errors or only react to specific errors. The available options are:
All Problems—Any problem encountered during this steps execution will cause the instructions specified in the On Error tab to be carried out.
Selected Problems—A list of errors that the step can generate is displayed. Only the selected errors will cause the instructions specified in the On Error tab to be carried out. Non-selected errors are ignored.
All except Selected—The non-selected errors will cause the instructions specified in the On Error tab to be carried out. Selected errors are ignored.
Custom Problem Code—This allows a custom error code to be entered in case it does not appear in the list of errors. Variables can be used in this parameter. NOTE: Use AMError to determine specific information about an error.
Time-out and error after this period of time—When enabled, this parameter acts as a time-out value for the step. For example, if a SQL Query step is being executed and this value is set to 30 seconds, if the query took longer than 30 seconds to complete, then the step would generate a time-out error and the instructions in the On Error tab would be carried out (disabled by default).
The On Error tab allows the task developer to determine what AWE should do if a particular step encounters an error as defined in the Error Causes tab (Properties are illustrated below). Three sections are provided in the On Error properties, each containing its own set of error procedures or actions.
If the step errors, carry out the following actions—If enabled, this
allows the task developer to specify that the step should be retried a
chosen number of times along with a chosen amount of time to wait between
retries, before actually considering it a true step failure, at which
case, the remainder of the error actions will be carried out.
Execute the following error actions—Allows a variety of error actions to be executed. Clicking the Add button opens the Error Action dialog box.
Start Task—Starts another task upon error. This action can be used to start a task to rectify the error. In the Task to start field, select the drop-down list of currently available set of tasks.
Set Variable—Sets the value of an existing variable. Can be used to set a variable with the return code. Select the variable in the Variable name box, and enter the value in the Variable value field.
Send E-mail—Sends an e-mail upon error. Useful way to alert the proper recipient(s) of the problem. The message will be populated with information about the specific error that occurred and other task information. In the To and From boxes, enter the recipient e-mail address and an e-mail address to be used in the From header. (Many SMTP mail servers require a valid From address.)
Play sound—Plays a specified sound file. In the Sound File box, click the Open Folder button and navigate to the sound file to be played.
Write to Windows Event Log—Writes the specified message to the Widows Event Log upon error. writes error data to the Windows event log. In the Text box, enter the text to be written to the log.
Write to Log—Writes the specified message to the AWE Event Log upon error. In the Text box, enter the text or specify the variable to be written to the log.
Stop task—Stops the task and initiates task level error handling. This is the default setting.
Continue to next step—Continues the task in spite of the step error. You can use this option if the error is non-critical or if additional error handling steps are located below this step.
Break Loop—Specifies that if the step is inside a loop, it should stop looping and go to the step (if any) following the End Loop.
Goto label—Goes to the specified label. (the label must be created in and earlier step using the Label action.) In the Label box, select the label. If the task has been saved, existing labels appear on the drop-down list.
Goto step—Specifies that AWE should skip to another step in the task. In the Step box, specify the step number to go to. NOTE: Too many Goto instructions can produce extremely unmanageable tasks. It is usually better to create a separate task and use Start Task instead.