31 #ifndef CPL_ERROR_H_INCLUDED
32 #define CPL_ERROR_H_INCLUDED
61 #ifdef STRICT_CPLERRORNUM_TYPE
81 CPLE_AWSBucketNotFound,
82 CPLE_AWSObjectNotFound,
84 CPLE_AWSInvalidCredentials,
85 CPLE_AWSSignatureDoesNotMatch,
90 typedef int CPLErrorNum;
93 #define CPLE_AppDefined 1
94 #define CPLE_OutOfMemory 2
96 #define CPLE_OpenFailed 4
97 #define CPLE_IllegalArg 5
98 #define CPLE_NotSupported 6
99 #define CPLE_AssertionFailed 7
100 #define CPLE_NoWriteAccess 8
101 #define CPLE_UserInterrupt 9
102 #define CPLE_ObjectNull 10
107 #define CPLE_HttpResponse 11
108 #define CPLE_AWSBucketNotFound 12
109 #define CPLE_AWSObjectNotFound 13
110 #define CPLE_AWSAccessDenied 14
111 #define CPLE_AWSInvalidCredentials 15
112 #define CPLE_AWSSignatureDoesNotMatch 16
118 void CPL_DLL
CPLError(CPLErr eErrClass, CPLErrorNum err_no,
const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (3, 4);
119 void CPL_DLL CPLErrorV(CPLErr, CPLErrorNum, const
char *, va_list );
126 void CPL_DLL
CPLErrorSetState( CPLErr eErrClass, CPLErrorNum err_no, const
char* pszMsg );
127 void CPL_DLL CPLCleanupErrorMutex(
void );
129 typedef
void (CPL_STDCALL *CPLErrorHandler)(CPLErr, CPLErrorNum, const
char*);
131 void CPL_DLL CPL_STDCALL CPLLoggingErrorHandler( CPLErr, CPLErrorNum, const
char * );
132 void CPL_DLL CPL_STDCALL CPLDefaultErrorHandler( CPLErr, CPLErrorNum, const
char * );
133 void CPL_DLL CPL_STDCALL CPLQuietErrorHandler( CPLErr, CPLErrorNum, const
char * );
134 void CPLTurnFailureIntoWarning(
int bOn );
143 void CPL_DLL CPL_STDCALL
CPLDebug( const
char *, const
char *, ... ) CPL_PRINT_FUNC_FORMAT (2, 3);
144 void CPL_DLL CPL_STDCALL
_CPLAssert( const
char *, const
char *,
int ) CPL_NO_RETURN;
147 # define CPLAssert(expr) ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
149 # define CPLAssert(expr)
158 # define VALIDATE_POINTER_ERR CE_Fatal
160 # define VALIDATE_POINTER_ERR CE_Failure
163 #define VALIDATE_POINTER0(ptr, func) \
164 do { if( NULL == ptr ) \
166 CPLErr const ret = VALIDATE_POINTER_ERR; \
167 CPLError( ret, CPLE_ObjectNull, \
168 "Pointer \'%s\' is NULL in \'%s\'.\n", #ptr, (func)); \
171 #define VALIDATE_POINTER1(ptr, func, rc) \
172 do { if( NULL == ptr ) \
174 CPLErr const ret = VALIDATE_POINTER_ERR; \
175 CPLError( ret, CPLE_ObjectNull, \
176 "Pointer \'%s\' is NULL in \'%s\'.\n", #ptr, (func)); \
177 return (rc); }} while(0)
void CPLPushErrorHandler(CPLErrorHandler)
Push a new CPLError handler.
Definition: cpl_error.cpp:1062
CPLErr CPLGetLastErrorType(void)
Fetch the last error type.
Definition: cpl_error.cpp:743
Core portability definitions for CPL.
void _CPLAssert(const char *, const char *, int) CPL_NO_RETURN
Report failure of a logical assertion.
Definition: cpl_error.cpp:1192
void CPLSetCurrentErrorHandlerCatchDebug(int bCatchDebug)
Set if the current error handler should intercept debug messages, or if they should be processed by t...
Definition: cpl_error.cpp:1158
const char * CPLGetLastErrorMsg(void)
Get the last error message.
Definition: cpl_error.cpp:767
CPLErrorHandler CPLSetErrorHandlerEx(CPLErrorHandler, void *)
Install custom error handle with user's data.
Definition: cpl_error.cpp:962
void CPLPopErrorHandler(void)
Pop error handler off stack.
Definition: cpl_error.cpp:1120
void CPLDebug(const char *, const char *,...)
Display a debugging message.
Definition: cpl_error.cpp:473
void CPLError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,...)
Report an error.
Definition: cpl_error.cpp:199
void CPLErrorReset(void)
Erase any traces of previous errors.
Definition: cpl_error.cpp:632
void * CPLGetErrorHandlerUserData(void)
Fetch the user data for the error context.
Definition: cpl_error.cpp:153
CPLErrorNum CPLGetLastErrorNo(void)
Fetch the last error number.
Definition: cpl_error.cpp:719
CPLErrorHandler CPLSetErrorHandler(CPLErrorHandler)
Install custom error handler.
Definition: cpl_error.cpp:1041
void CPLErrorSetState(CPLErr eErrClass, CPLErrorNum err_no, const char *pszMsg)
Restore an error state, without emitting an error.
Definition: cpl_error.cpp:666
void CPLEmergencyError(const char *) CPL_NO_RETURN
Fatal error when things are bad.
Definition: cpl_error.cpp:385
void CPLPushErrorHandlerEx(CPLErrorHandler, void *)
Push a new CPLError handler with user data on the error context.
Definition: cpl_error.cpp:1086