# ErrHandling()

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

Member of the MccService class.

## Function Prototype

VB .NET

Public Shared Function ErrHandling(ByVal errorReporting As MccDaq.ErrorReporting, ByVal errorHandling As MccDaq.ErrorHandling) As MccDaq.ErrorInfo

C# .NET

public static MccDaq.ErrorInfo ErrHandling(MccDaq.ErrorReporting errorReporting, MccDaq.ErrorHandling errorHandling)

## Parameters

errorReporting

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

errorHandling

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

## Returns

- Returns an ErrorInfo object that always has ErrorInfo.Value = NoErrors.

### errorReporting parameter values

All of the errorReporting settings are MccDaq.ErrorReporting enumerated constants. To set a variable to one of these constants, you must refer to the MccDaq object and the ErrorReporting enumeration (for example, variable = MccDaq.ErrorReporting.DontPrint, variable = MccDaq.ErrorReporting.PrintWarnings, etc.).

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.

### errorHandling parameter values

All of the errorReporting settings are MccDaq.ErrorHandling enumerated constants. To set a variable to one of these constants, you must refer to the MccDaq object and the ErrorHandling enumeration (for example, variable = MccDaq.ErrorHandling.DontStop, variable = MccDaq.ErrorHandling.StopFatal, etc.).

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) then when errors occur, the environment may be shut down along with the program. If your IDE behaves this way, then you should set ErrHandling() to DONTSTOP. You can check error codes to determine the cause of the error.

## Note

##### 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."