Cicode Programming Reference > Cicode Function Categories > Error Functions Introduction > ErrTrap

ErrTrap

Generates an error trap. If CitectSCADA error checking is enabled, this function will generate a hardware error and may halt Cicode execution (see bHalt argument). If user error checking is enabled, the user function specified in OnEvent(2,Fn) is called.

Syntax

ErrTrap(Error, bHalt)

Error:

The error number to trap.

bHalt:

Determines whether the Cicode execution will be halted.

0 - Cicode execution is not halted

1 - Cicode execution is halted

Return Value

0 (zero) if successful, otherwise an error is returned.

ErrSetHw, ErrSet, ErrSetLevel, OnEvent

Example

IF Tag=0 THEN
ErrTrap(273); ! Traps a divide by zero error.
ELSE
Value=10/Tag;
END

See Also

Error Functions