OnError Ignore|End|Fail|Skipto|ResumeHere [<label or options>]
This function controls the error handling for all subsequent commands or until it is changed by another OnError command).
OnError Ignore will ignore all command results and continue with the script. However, a more preferrable way to achieve this is to prefix commands with a dash (e.g. -LocalDelete "abc.tmp", see Program- and Comand Styles).
OnError End will skip all following commands (except milestones) and will terminate the script.
OnError Fail will terminate the script at once (will not process milestones).
OnError SkipTo <label> will skip all subsequent commands until it finds an occurrence of :<label> (multiple ocurrences of the same label are allowed).
OnError ResumeHere <RetryCount> <Delay> will resume at th point of the OnError command <RetryCount> times after the given delay (in seconds). If it still fails after the last retry it will resume with the previous OnError handling, which will usually be either a "skipto" or "fail" command (see Expample 2 below).
See also: Error, Transaction and
SendMail, Script Example
Example 1:
OnError SkipTo "SendErrorMail"
Connect ...
Get ...
Disconnect
exit
:SendErrorMail
sendmail ...
exit
Example 2:
# retry this site 3 times then proceed with next
OnError SkipTo "NextSite"
OnError ResumeHere 3 10
Connect ...
Get ...
Disconnect
:NextSite
OnError SkipTo "NextSite"
OnError ResumeHere 3 10
Connect ...
...
exit
← Back to Script Commands