Cicode Programming Reference > Cicode Function Categories > Error Functions > ErrSetLevel

ErrSetLevel

Sets the nesting error level to enable Citect SCADA error checking inside a nested function (when Citect SCADA error checking has been disabled). This function returns the old error level and sets a new error level.

The nesting error level is incremented every time the ErrSet(1) function is called.

Syntax

ErrSetLevel(Level)

Level:

The nesting error level.

Return Value

Returns the old error level and sets a new error level.

Related Functions

ErrSet

Example

! ErrorLevel 0 defaults to ErrSet(0) - enables Citect SCADA error-checking.
FUNCTION MainFn()
ErrSet(1);
! ErrorLevel 1 - disables Citect SCADA error checking.
Fn1();
ErrSet(0);
! Enables Citect SCADA error checking.
END
FUNCTION Fn1()
ErrSet(1);
! ErrorLevel 2 - disables Citect SCADA error checking.
Test=Var/0;
Error=IsError();
! Sets Error to 273 (divide by zero).
Fn2();
ErrSet(0); ! Enables Citect SCADA error checking.
END
FUNCTION Fn2()
OldErrorLevel=ErrSetLevel(0);
! Sets nesting error level to 0 to enable Citect SCADA error-checking.
Test=Var/0;
! Cicode halts and a hardware alarm is generated.
ErrSetLevel(OldErrorLevel)
! Resets nesting error level to disable Citect SCADA error-checking.
END

See Also

Error Functions

Published June 2018