SDTS_AL
|
Go to the source code of this file.
Macros | |
#define | CPLE_None 0 |
#define | CPLE_AppDefined 1 |
#define | CPLE_OutOfMemory 2 |
#define | CPLE_FileIO 3 |
#define | CPLE_OpenFailed 4 |
#define | CPLE_IllegalArg 5 |
#define | CPLE_NotSupported 6 |
#define | CPLE_AssertionFailed 7 |
#define | CPLE_NoWriteAccess 8 |
#define | CPLE_UserInterrupt 9 |
#define | CPLE_ObjectNull 10 |
#define | CPLE_HttpResponse 11 |
#define | CPLE_AWSBucketNotFound 12 |
#define | CPLE_AWSObjectNotFound 13 |
#define | CPLE_AWSAccessDenied 14 |
#define | CPLE_AWSInvalidCredentials 15 |
#define | CPLE_AWSSignatureDoesNotMatch 16 |
#define | CPLAssert(expr) |
#define | VALIDATE_POINTER0(ptr, func) |
#define | VALIDATE_POINTER1(ptr, func, rc) |
Typedefs | |
typedef int | CPLErrorNum |
typedef void(CPL_STDCALL * | CPLErrorHandler) (CPLErr, CPLErrorNum, const char *) |
Enumerations | |
enum | CPLErr |
Functions | |
void CPL_DLL void CPL_DLL | CPLErrorV (CPLErr, CPLErrorNum, const char *, va_list) |
void CPL_DLL | CPLEmergencyError (const char *) CPL_NO_RETURN |
void CPL_DLL CPL_STDCALL | CPLErrorReset (void) |
CPLErrorNum CPL_DLL CPL_STDCALL | CPLGetLastErrorNo (void) |
CPLErr CPL_DLL CPL_STDCALL | CPLGetLastErrorType (void) |
const char CPL_DLL *CPL_STDCALL | CPLGetLastErrorMsg (void) |
void CPL_DLL *CPL_STDCALL | CPLGetErrorHandlerUserData (void) |
void CPL_DLL | CPLErrorSetState (CPLErr eErrClass, CPLErrorNum err_no, const char *pszMsg) |
void CPL_DLL CPL_STDCALL | CPLLoggingErrorHandler (CPLErr, CPLErrorNum, const char *) |
void CPL_DLL CPL_STDCALL | CPLDefaultErrorHandler (CPLErr, CPLErrorNum, const char *) |
void CPL_DLL CPL_STDCALL | CPLQuietErrorHandler (CPLErr, CPLErrorNum, const char *) |
void | CPLTurnFailureIntoWarning (int bOn) |
CPLErrorHandler CPL_DLL CPL_STDCALL | CPLSetErrorHandler (CPLErrorHandler) |
CPLErrorHandler CPL_DLL CPL_STDCALL | CPLSetErrorHandlerEx (CPLErrorHandler, void *) |
void CPL_DLL CPL_STDCALL | CPLPushErrorHandler (CPLErrorHandler) |
void CPL_DLL CPL_STDCALL | CPLPushErrorHandlerEx (CPLErrorHandler, void *) |
void CPL_DLL CPL_STDCALL | CPLSetCurrentErrorHandlerCatchDebug (int bCatchDebug) |
void CPL_DLL CPL_STDCALL | CPLPopErrorHandler (void) |
void CPL_DLL CPL_STDCALL void CPL_DLL CPL_STDCALL | _CPLAssert (const char *, const char *, int) CPL_NO_RETURN |
CPL error handling services.
#define CPLAssert | ( | expr | ) |
Assert on an expression. Only enabled in DEBUG mode
#define CPLE_AppDefined 1 |
Application defined error
#define CPLE_AssertionFailed 7 |
Assertion failed
#define CPLE_AWSAccessDenied 14 |
AWSAccessDenied
#define CPLE_AWSBucketNotFound 12 |
AWSBucketNotFound
#define CPLE_AWSInvalidCredentials 15 |
AWSInvalidCredentials
#define CPLE_AWSObjectNotFound 13 |
AWSObjectNotFound
#define CPLE_AWSSignatureDoesNotMatch 16 |
AWSSignatureDoesNotMatch
#define CPLE_FileIO 3 |
File I/O error
#define CPLE_HttpResponse 11 |
HTTP response
#define CPLE_IllegalArg 5 |
Illegal argument
#define CPLE_None 0 |
No error
#define CPLE_NotSupported 6 |
Not supported
#define CPLE_NoWriteAccess 8 |
No write access
#define CPLE_ObjectNull 10 |
NULL object
#define CPLE_OpenFailed 4 |
Open failed
#define CPLE_OutOfMemory 2 |
Out of memory error
#define CPLE_UserInterrupt 9 |
User interrupted
#define VALIDATE_POINTER0 | ( | ptr, | |
func | |||
) |
Validate that a pointer is not NULL
#define VALIDATE_POINTER1 | ( | ptr, | |
func, | |||
rc | |||
) |
Validate that a pointer is not NULL, and return rc if it is NULL
typedef void(CPL_STDCALL * CPLErrorHandler) (CPLErr, CPLErrorNum, const char *) |
Callback for a custom error handler
typedef int CPLErrorNum |
Error number
enum CPLErr |
Error category
void CPL_DLL CPL_STDCALL void CPL_DLL CPL_STDCALL _CPLAssert | ( | const char * | pszExpression, |
const char * | pszFile, | ||
int | iLine | ||
) |
Report failure of a logical assertion.
Applications would normally use the CPLAssert() macro which expands into code calling _CPLAssert() only if the condition fails. _CPLAssert() will generate a CE_Fatal error call to CPLError(), indicating the file name, and line number of the failed assertion, as well as containing the assertion itself.
There is no reason for application code to call _CPLAssert() directly.
void CPL_DLL CPL_STDCALL CPLDefaultErrorHandler | ( | CPLErr | eErrClass, |
CPLErrorNum | nError, | ||
const char * | pszErrorMsg | ||
) |
Default error handler.
void CPL_DLL CPLEmergencyError | ( | const char * | pszMessage | ) |
Fatal error when things are bad.
This function should be called in an emergency situation where it is unlikely that a regular error report would work. This would include in the case of heap exhaustion for even small allocations, or any failure in the process of reporting an error (such as TLS allocations).
This function should never return. After the error message has been reported as best possible, the application will abort() similarly to how CPLError() aborts on CE_Fatal class errors.
pszMessage | the error message to report. |
void CPL_DLL CPL_STDCALL CPLErrorReset | ( | void | ) |
Erase any traces of previous errors.
This is normally used to ensure that an error which has been recovered from does not appear to be still in play with high level functions.
void CPL_DLL CPLErrorSetState | ( | CPLErr | eErrClass, |
CPLErrorNum | err_no, | ||
const char * | pszMsg | ||
) |
Restore an error state, without emitting an error.
Can be useful if a routine might call CPLErrorReset() and one wants to preserve the previous error state.
void CPL_DLL void CPL_DLL CPLErrorV | ( | CPLErr | eErrClass, |
CPLErrorNum | err_no, | ||
const char * | fmt, | ||
va_list | args | ||
) |
Same as CPLError() but with a va_list
void CPL_DLL* CPL_STDCALL CPLGetErrorHandlerUserData | ( | void | ) |
Fetch the user data for the error context
Fetches the user data for the current error context. You can set the user data for the error context when you add your handler by issuing CPLSetErrorHandlerEx() and CPLPushErrorHandlerEx(). Note that user data is primarily intended for providing context within error handlers themselves, but they could potentially be abused in other useful ways with the usual caveat emptor understanding.
const char CPL_DLL* CPL_STDCALL CPLGetLastErrorMsg | ( | void | ) |
Get the last error message.
Fetches the last error message posted with CPLError(), that hasn't been cleared by CPLErrorReset(). The returned pointer is to an internal string that should not be altered or freed.
CPLErrorNum CPL_DLL CPL_STDCALL CPLGetLastErrorNo | ( | void | ) |
Fetch the last error number.
Fetches the last error number posted with CPLError(), that hasn't been cleared by CPLErrorReset(). This is the error number, not the error class.
CPLErr CPL_DLL CPL_STDCALL CPLGetLastErrorType | ( | void | ) |
Fetch the last error type.
Fetches the last error type posted with CPLError(), that hasn't been cleared by CPLErrorReset(). This is the error class, not the error number.
void CPL_DLL CPL_STDCALL CPLLoggingErrorHandler | ( | CPLErr | eErrClass, |
CPLErrorNum | nError, | ||
const char * | pszErrorMsg | ||
) |
Error handler that logs into the file defined by the CPL_LOG configuration option, or stderr otherwise.
void CPL_DLL CPL_STDCALL CPLPopErrorHandler | ( | void | ) |
Pop error handler off stack.
Discards the current error handler on the error handler stack, and restores the one in use before the last CPLPushErrorHandler() call. This method has no effect if there are no error handlers on the current threads error handler stack.
void CPL_DLL CPL_STDCALL CPLPushErrorHandler | ( | CPLErrorHandler | pfnErrorHandlerNew | ) |
Push a new CPLError handler.
This pushes a new error handler on the thread-local error handler stack. This handler will be used until removed with CPLPopErrorHandler().
The CPLSetErrorHandler() docs have further information on how CPLError handlers work.
pfnErrorHandlerNew | new error handler function. |
void CPL_DLL CPL_STDCALL CPLPushErrorHandlerEx | ( | CPLErrorHandler | pfnErrorHandlerNew, |
void * | pUserData | ||
) |
Push a new CPLError handler with user data on the error context.
This pushes a new error handler on the thread-local error handler stack. This handler will be used until removed with CPLPopErrorHandler(). Obtain the user data back by using CPLGetErrorContext().
The CPLSetErrorHandler() docs have further information on how CPLError handlers work.
pfnErrorHandlerNew | new error handler function. |
pUserData | User data to put on the error context. |
void CPL_DLL CPL_STDCALL CPLQuietErrorHandler | ( | CPLErr | eErrClass, |
CPLErrorNum | nError, | ||
const char * | pszErrorMsg | ||
) |
Error handler that does not do anything, except for debug messages.
void CPL_DLL CPL_STDCALL CPLSetCurrentErrorHandlerCatchDebug | ( | int | bCatchDebug | ) |
Set if the current error handler should intercept debug messages, or if they should be processed by the previous handler.
By default when installing a custom error handler, this one intercepts debug messages. In some cases, this might not be desirable and the user would prefer that the previous installed handler (or the default one if no previous installed handler exists in the stack) deal with it. In which case, this function should be called with bCatchDebug = FALSE.
bCatchDebug | FALSE if the current error handler should not intercept debug messages |
CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandler | ( | CPLErrorHandler | pfnErrorHandlerNew | ) |
Install custom error handler.
Allow the library's user to specify an error handler function. A valid error handler is a C function with the following prototype:
void MyErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
Pass NULL to come back to the default behavior. The default behaviour (CPLDefaultErrorHandler()) is to write the message to stderr.
The msg will be a partially formatted error message not containing the "ERROR %d:" portion emitted by the default handler. Message formatting is handled by CPLError() before calling the handler. If the error handler function is passed a CE_Fatal class error and returns, then CPLError() will call abort(). Applications wanting to interrupt this fatal behaviour will have to use longjmp(), or a C++ exception to indirectly exit the function.
Another standard error handler is CPLQuietErrorHandler() which doesn't make any attempt to report the passed error or warning messages but will process debug messages via CPLDefaultErrorHandler.
Note that error handlers set with CPLSetErrorHandler() apply to all threads in an application, while error handlers set with CPLPushErrorHandler are thread-local. However, any error handlers pushed with CPLPushErrorHandler (and not removed with CPLPopErrorHandler) take precedence over the global error handlers set with CPLSetErrorHandler(). Generally speaking CPLSetErrorHandler() would be used to set a desired global error handler, while CPLPushErrorHandler() would be used to install a temporary local error handler, such as CPLQuietErrorHandler() to suppress error reporting in a limited segment of code.
pfnErrorHandlerNew | new error handler function. |
CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandlerEx | ( | CPLErrorHandler | pfnErrorHandlerNew, |
void * | pUserData | ||
) |
Install custom error handle with user's data. This method is essentially CPLSetErrorHandler with an added pointer to pUserData. The pUserData is not returned in the CPLErrorHandler, however, and must be fetched via CPLGetErrorHandlerUserData.
pfnErrorHandlerNew | new error handler function. |
pUserData | User data to carry along with the error context. |
void CPLTurnFailureIntoWarning | ( | int | bOn | ) |
Whether failures should be turned into warnings.