# cbErrHandling()

Sets the error handling for all subsequent function calls. Most functions return error codes after each call. In addition, other error handling features are built into the library. This function controls those features. If the Universal Library cannot find the configuration file CB.CFG, it always terminates the program, regardless of the cbErrHandling() setting.

## Function Prototype

C/C++

int cbErrHandling(int ErrReporting, int ErrHandling)

Visual Basic

Function cbErrHandling(ByVal ErrReporting&, ByVal ErrHandling&) As Long

## Arguments

ErrReporting

This argument controls when the library will print error messages on the screen. The default is DONTPRINT. Set it to one of the constants in the "ErrReporting argument values" section below.

ErrHandling

This argument specifies what class of error will cause the program to halt. The default is DONTSTOP. Set it to one of the constants in the "ErrHandling argument values" section below.

## Returns

- Always returns 0.

### ErrReporting argument values

DONTPRINT | Errors will not generate a message to the screen. In that case your program must always check the returned error code after each library call to determine if an error occurred.
PRINTWARNINGS | Only warning errors will generate a message to the screen. Your program will have to check for fatal errors.
PRINTFATAL | Only fatal errors will generate a message to the screen. Your program must check for warning errors.
PRINTALL | All errors will generate a message to the screen.

### ErrHandling argument values

DONTSTOP | The program will always continue executing when an error occurs.
STOPFATAL | The program will halt if a "fatal" error occurs.
STOPALL | Will stop whenever any error occurs. If you are running in an Integrated Development Environment (IDE), when errors occur the environment may be shut down along with the program. If your IDE behaves this way, (QuickBasic and VisualBasic do), then set ErrHandling to DONTSTOP. Refer to the "Error Codes" topic for a complete list of error codes and their associated messages.

## Notes

- Warnings vs Fatal Errors: All errors that can occur are classified as either "warnings" or "fatal":
- Errors that can occur in normal operation in a bug free program (disk is full, too few samples before trigger occurred) are classified as "warnings".
- All other errors indicate a more serious problem and are classified as "fatal".
- STOPALL is not intended for 32-bit C console programs: Do not use the STOPALL option in 32-bit C console applications. Instead, use other methods to end the program, such as checking the return value of the function.