ImageGear Professional v18.2 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Error Functions > IG_error_get |
This function retrieves an ImageGear Error Code and associated information from the error stack.
Copy Code
|
|
---|---|
VOID ACCUAPI IG_error_get( INT iErrorIndex, LPSTR szFileName, INT cbFileNameSize, LPINT lpiLineNumber, LPAT_ERRCODE lpiCode, LPAT_INT lplValue1, LPAT_INT lplValue2 ); |
Name | Type | Description |
iErrorIndex | INT | Tells which error to fetch from stack. A value of 0 means fetch the first error placed on the stack. |
szFileName | LPSTR | Pointer indicating where to return the module name in which this error occurred. If this pointer is NULL, the module name is not returned. |
cbFileNameSize | INT | Number of bytes available in byte array pointed to by szFileName. |
lpiLineNumber | LPINT | Pointer indicating where to return the line number at which the error occurred. If NULL, the line number is not returned. |
lpiCode | LPAT_ERRCODE | Pointer indicating where to return the Error Code. If NULL, the Error Code is not returned. |
lplValue1 | LPAT_INT | Pointer indicating where to return a value stored as lValue1 when the error occurred. If NULL, this value is not returned. See Remarks below for explanation of lValue1 and lValue2. |
lplValue2 | LPAT_INT | Pointer indicating where to return a value stored as lValue2 when the error occurred. If NULL, this value is not returned. See Remarks below for explanation of lValue1 and lValue2. |
None
This function does not process image pixels.
Copy Code
|
|
---|---|
INT i; // Loop Index and Error Index INT iLineNumber; // Returned Line Number CHAR szFileName[255] = {0}; // Returned module name, up to 254 chars AT_INT lValue1, lValue2; // Returned lValue1, lValue2 AT_ERRCODE iCode; // Returned ImageGear Error Code AT_ERRCOUNT nErrcount; // Count of errors on error stack CHAR szBuf[355]; // Buffer for string to be displayed // Get number of errors on stack nErrcount = IG_error_check(); for ( i = 0; i < nErrcount; i++ ) { // Get Module Name, Line Number, Error Code, and lValue1, lValue2: IG_error_get ( i, (LPSTR) szFileName, sizeof(szFileName) - 1, &iLineNumber, (LPAT_ERRCODE)&iCode, (LPAT_INT) &lValue1, (LPAT_INT) &lValue2 ); // Format error message in szBuf: sprintf ( szBuf, ("Error %d in Module %s at Line %d"), iCode, szFileName, iLineNumber ); // Print error message to stdout printf ( szBuf ); } // Done getting errors, clear the error stack IG_error_clear(); |
Set iErrorIndex to indicate which error to get. iErrorIndex = 0 means the error added to the stack first. The other arguments (except cbFileNameSize) are pointers telling this function where to return the retrieved information to you. This information consists of the Error Code, the module name and line number at which the error occurred, and two additional values (lValue1 and lValue2) which may provide additional information about the error. See Function Error Return Codes for a list of all ImageGear Error Codes and the significance of lValue1, lValue2 where applicable.
To determine the number of errors currently on the error stack use IG_error_check. After fetching all error information you need using IG_error_get, use IG_error_clear to clear the stack. |
A call to this function has the same effect as a call to IG_err_error_get with nLevel equal to 0 and lpExtraText equal to NULL.