Error Handling

 

Top  Previous  Next

Before reporting errors to Dynarithmic Software pertaining to DTWAIN, please make sure that

 

You are checking all DTWAIN functions for a "successful" return value.

 

You generate a log file by calling DTWAIN_SetTwainLog.  This is important if there is an issue with your driver or if you are not using DTWAIN properly.  The log reveals everything as far as what DTWAIN functions are being called, and how the TWAIN Data Source Manager is responding when DTWAIN calls the TWAIN DSM to invoke certain functions.

 

DTWAIN functions usually return a successful value(s) or a single unsuccessful value (a FALSE, -1, etc.).  If a DTWAIN function returns a failure code, there is a good reason for the failure, and it can be discovered by calling DTWAIN_GetLastError.  Many of the examples in this help file do not check for the error code.  This is only done for brevity -- your application should always check for any potential error codes.

 

The error codes have a corresponding error string, so that you can get a description of the error.  The function to call that gets the error string is DTWAIN_GetErrorString.

 

In addition, DTWAIN has an option of popping up a message box whenever a DTWAIN error occurs.  The message box describes the error and the DTWAIN function where the error occurred.  This option can be turned on or off using the DTWAIN32.INI file, or programatically using the DTWAIN_SetTwainLog function.  The message box option is always turned on, unless it is turned off by the DTWAIN32.INI setting or using DTWAIN_SetTwainLog.

 

Another feature is that DTWAIN logs exception errors -- errors that would usually bring down an application.  This allows you to keep an application going if an exception occurs (you can then check the error by calling DTWAIN_GetLastError.  You should get back a DTWAIN_ERR_EXCEPTION error code).

 

The log generated by DTWAIN_SetTwainLog is beneficial, if not essential, when reporting problems with your application and DTWAIN to Dynarithmic support.  Please make sure that you have the appropriate log file(s) generated when you are seeking support.