IFERROR        Test result code and conditionally branch to label

Top  Previous  Next

Syntax:

IFERRORxx

[ rcode ]  goto  [ label ]

Forms:

IFERROR

[ rcode ]  goto  [ label ]

 

IFERROR=

[ rcode ]  goto  [ label ]

 

IFERROR<

[ rcode ]  goto  [ label ]

 

IFERROR>

[ rcode ]  goto  [ label ]

 

IFERROR<=

[ rcode ]  goto  [ label ]

 

IFERROR>=

[ rcode ]  goto  [ label ]

 

IFERROR! =

[ rcode ]  goto  [ label ]

Arguments:

[ rcode ]

Optional numeric value or $ERROR variable associated with result codes returned by script commands upon completion; any successful operation returns a value of 0.

 

[ label ]

A valid label within the current script file which is branched to if the conditional test is successful.

Options:

none

 

 

 

This script command checks the result of the previously executed command to see if IFERRORxx [ rcode ] is true. If so, the script file branches to [ label ], otherwise execution continues with the next command.

 

The [ rcode ] may be omitted if you do not wish to test for a specific error condition. A value of 1 is assumed, which results in testing for any error condition. The following variations of the IFERROR command are supported:

 

IFERROR= (equal to)
IFERROR< (less than)
IFERROR> (greater than)
IFERROR<= (less than or equal to)
IFERROR!= (not equal to)
IFERROR or IFERROR>= (greater than or equal to)

 

Syntactically no space is permitted to the left of the '=', '<' or '>' symbols, and a space is required to the right of these symbols.

 

Consider the following examples.

 

;; if result code is greater than 1046 then branch to label

;; 'next', else continue with the next line

IFERROR> 1046 goto next

;; if result code equals predefined $ERROR variable then branch

;; to label 'next'

IFERROR $ERROR_CONNECT_TIMEOUT goto next

 

Related Command(s): LOOPIF, GOTO

See also: Script File Result Codes