OnError: Execute script upon error
Tag: OnError
A script from another file/job or from a variable in the current script can be executed when an error occurs.
Tag Attributes
Attributes | Attribute Values | Value Description |
---|---|---|
User Definable | The external script file path and name to be used. | |
User Definable | The variable to be used. NB: here the variable name must be used without the variable syntax {% and %} <OnError ExecuteVar=”VarName”/> is OK <OnError ExecuteVar=”{%VarName%}”/> is NOT OK |
Continue, MsgBox, Execute and ExecuteVar are not mutually exclusive.
When a combination is set, the sequence is:
MsgBox
Execute
ExecuteVar
If continue is set to True, the script then goes on.
When set in an OnError action, Execute and ExecuteVar indicate which automation directives to run everytime an error is met. The error actually triggers a regular Execute / ExecuteVar call.
Example Script
<ytriaAutomation>
starts onerror-dlg.xml upon error:
<OnError execute="onerror-dlg.xml"/>
starts the XML contained in MyVar upon error:
<OnError executeVar="MyVar"/>
displays a message box upon error:
<OnError MsgBox="ERROR"/>
all options can be set at once:
<OnError executeVar="MyVar" execute="onerror-dlg.xml" continue="true" MsgBox="ERROR"/>
<SetVar MyVar="USE_CDATA" BypassVar="true">
<![CDATA[ <SetVar Error1="ERROR 1"/>
<MsgBox Message="Error {%error1%} {%Error2%}!"/>]]>
</SetVar>
<SetVar error2="ERROR 2"/>
triggers error:
<Unselect/>
<MsgBox Message="THE END"/>
</ytriaAutomation>