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

ErrSetLevel

Sets the nesting error level to enable CitectSCADA error checking inside a nested function (when CitectSCADA 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

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

Related Functions

ErrSet

Example

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

See Also

Error Functions