On Error

Description

Allows the task developer to determine what AutoMate should do if a particular step encounters an error as defined in the Error Causes properties. The default behavior is that task execution stops in the immediate step that encounters the error. However, On Error further extends AutoMate's step level error handling capabilities by enabling the developer to set a specific amount of times the step should be re-executed upon the event of an error, designate what actions should be performed upon error as well as how the step should respond directly after the error event occurs. For example, a step can retry 3 times upon error. If the problem still occurs after the third iteration, the step can send an email, execute another task or log specific text to the Windows Event Log or AutoMate Event Log. In addition, a step can be set to continue to the next step or jump to a specific step directly after the error event occurs.

NOTE: All On Error properties are optional entries.  

Practical Usage

Used to control what the task step should do upon occurrence of an error.    

Related Topics

Parameters

Property

Type

Default

Markup

Description

Retry the step x times

Number

(Disabled)

AM_RETRY="6"

Indicates the amount of times execution of this step should be retried if it encounters an error as defined in the Error Causes properties. This property is disabled by default.

Pausing x milliseconds between tries

Number

(Disabled)

AM_RETRYDELAY="3000"

Specifies the value in milliseconds this step should wait between retries as defined in the Retry the step x times parameter. This property is active only if the Retry the step x times parameter is enabled.

Execute the following error actions

Text

(Empty)

AM_RUNTASK="Task1"(Start Task)

AM_SETVAR="Var1;0"(Set Variable)

AM_EMAIL="mm@mycompany.com"(Send Email)

 

AM_WRITETOEVENTLOG="0"(Write to Log)

Allows a variety of actions to be executed upon the occurrence of an error. Click Add to add a new error action,  click Modify to edit an existing entry or click Remove to delete an entry. This property is disabled by default. The available options are:

  • 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 drop down, select the desired task.
  • Set Variable - Sets the value of an existing variable upon error. 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 as well as other important task information.
  • NOTE: Many SMTP mail servers require a valid From address.
  • Play Sound - Plays the selected sound (.wav) file upon error. 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. In the Text box, enter the text or specify the variable to be written to the log.  
  • Write to Log - Writes the specified message to the AutoMate Event Log upon error. In the Text box, enter the text or specify the variable to be written to the AutoMate log.  

After error event

Text

(Empty)

a)AM_ONERROR="BREAKLOOP"

b)AM_ONERROR="CONTINUE"

Determines what should occur after the occurrence of an error event. The available options are:

  • Stop Task (default) - Execution stops in the immediate step that encounters the error.

  • Continue to next step - Continues task execution to the next step. This option continues the task in spite of the step error. Use this option if the error is non-critical or if additional error handling steps are specified in a subsequent step.

  • Break loop - Breaks out of a loop. If the step is inside a loop, it should stop looping and go to the step (if any) following the End Loop.

  • Goto label - Continues task execution to the label specified. The label must be created in an earlier step using the Label action.

  • Goto step - Continues task execution to the step specified. This allows the task to skip to another step in the task upon error.

NOTE: Too many Goto instructions can produce extremely unmanageable tasks. It is usually better to create a separate task and use Start Task instead.

 

p Back to Top