ImageGear for C and C++ on Linux v18.10 - Updated
IG_error_set
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Error Functions > IG_error_set

This function places an ImageGear error onto the error stack.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_error_set(
   const LPSTR szFileName,
   INT iLineNumber,
   AT_ERRCODE iCode,
   AT_INT lValue1,
   AT_INT lValue2
);

Arguments:

Name Type Description
szFileName const LPSTR Pointer to a string that supplies the name of the module from which the error was generated. It is recommended that you use the _FILE_ constant in this field.
iLineNumber INT An integer telling ImageGear from which line the error was set. It is recommended that you use the _LINE_ constant in this field.
iCode AT_ERRCODE An integer value of type AT_ERRCODE. Set this to the code number of the error that you wish to place on the error stack.
lValue1 AT_INT The first argument that supplies any supporting information about the error. Your application might use this value to decide what to do after setting a particular kind of error.
lValue2 AT_INT The second argument that supplies any supporting information about the error. Your application might use this value to decide what to do after setting a particular kind of error.

Return Value:

None

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
static const AT_ERRCODE MYERR_BAD_RASTER = (IGE_LAST_ERROR_NUMBER - 1);
AT_ERRCOUNT nErrcount = IG_error_set(__FILE__, __LINE__, MYERR_BAD_RASTER, 0, 0);

Remarks:

One use for this function is with the callback functions. It allows you to write the loading and saving of DIBs and individual raster lines (IG_load_FD_CB, IG_save_FD_CB_ex) to the handle. Each of these functions call your callback functions in order to supply data, such as width, height, and Bits Per Pixel, to ImageGear. Your callback functions (which must be of type LPFNIG_DIB_GET, LPFNIG_RASTER_GET, LPFNIG_DIB_CREATE, and LPFNIG_RASTER_SET), must return an error count to IG_load_FD_CB and IG_save_FD_CB. You would do this by calling IG_error_check after each raster is loaded or saved. If you wanted to terminate the load or save, you could use IG_error_set to place the ImageGear error of your choice upon the stack.

If you are setting an error code that you have defined yourself, you must make sure that it has a value less than ImageGear's IGE_LAST_ERROR_NUMBER. As the defined value of IGE_LAST_ERROR_NUMBER may change in the future, you should define your error codes relatively to IGE_LAST_ERROR_NUMBER, as demonstrated in the example, rather than use literal values.