Cicode Programming Reference > Using Cicode Programming Standards > Function Error handling

Function Error handling

Errors are handled by examining the return values of the functions. The Cicode functions can be classified as regards their return value as follows:

Functions returning

Calling functions should check for

Error code only

0 no error (success)

> 0 error code

Handles

-1 bad handle

>= 0 valid handle

Random values

the return of IsError()

The following Cicode functions can halt the current task:

DevOpen, DevHistory, DevNext, DevPrev, DevSeek, DevFind, DevFlush, DevRecNo, DevRead, DevReadLn, DevAppend, DevDelete, DevZap, DevControl , DevPrint , DevModify, ErrTrap; FileOpen, FileClose, FileReadBlock, FileWriteBlock, FileSeek, FileDelete, FileReName, FileSize, FileReadLn, FileCopy; FormNew; SQLConnect, SQLTraceOn, SQLTraceOff, SQLErrMsg.

If an error is detected in one of these functions, your Cicode task will generate a hardware error and be halted. You may stop your Cicode task from being halted by using the ErrSet() function and checking for errors using IsError().

The parameter [Code]HaltOnError allows you to stop any errors detected in these functions from halting your Cicode. If you set. . .

[code]
HaltOnError=0

then your Cicode will continue to run after a hardware error is detected in these functions.

For example:

See Also

Debugging Cicode