Retry Statement

Retries a non-fatal run-time (recoverable) error and resumes execution to the statement that caused the error.

Syntax

Retry

Comments

This statement can be used only in error handling code (Catch blocks and OnError events). Execution of this statement outside of error handling code or if the error being handled is not recoverable, results in a run-time error. A valid Retry statement causes execution to resume at the start of the statement which caused the error. If the error occurred inside a Try block, execution resumes immediately after the Try statement in the Try-Catch-EndTry compound statement with the Catch statement that caught the error.

Example

The following example allows three retries in a program before it is aborted.

Procedure Program1.OnError(): Void

{

Print "Error has occurred."

Retries=iRetries+1

If iRetries < 3 Then

Print "Trying to retry..."

Retry

Else

Print "Retry has failed. Aborting..."

Abort

Endif

}

See Also

Abort Statement, Error Statement, GetErrorMsg, GetErrorNum, Ignore, Pause, Try