31 #ifndef CPL_ERROR_H_INCLUDED
32 #define CPL_ERROR_H_INCLUDED
65 #ifdef STRICT_CPLERRORNUM_TYPE
99 #define CPLE_AppDefined 1
101 #define CPLE_OutOfMemory 2
103 #define CPLE_FileIO 3
105 #define CPLE_OpenFailed 4
107 #define CPLE_IllegalArg 5
109 #define CPLE_NotSupported 6
111 #define CPLE_AssertionFailed 7
113 #define CPLE_NoWriteAccess 8
115 #define CPLE_UserInterrupt 9
117 #define CPLE_ObjectNull 10
123 #define CPLE_HttpResponse 11
125 #define CPLE_AWSBucketNotFound 12
127 #define CPLE_AWSObjectNotFound 13
129 #define CPLE_AWSAccessDenied 14
131 #define CPLE_AWSInvalidCredentials 15
133 #define CPLE_AWSSignatureDoesNotMatch 16
135 #define CPLE_AWSError 17
150 void CPL_DLL
CPLErrorSetState( CPLErr eErrClass, CPLErrorNum err_no, const
char* pszMsg );
152 void CPL_DLL CPLCleanupErrorMutex(
void );
170 #ifdef WITHOUT_CPLDEBUG
171 #define CPLDebug(...)
173 void CPL_DLL CPL_STDCALL CPLDebug(
const char *,
CPL_FORMAT_STRING(
const char *), ...)
177 void CPL_DLL CPL_STDCALL
_CPLAssert(
const char *,
const char *,
int ) CPL_NO_RETURN;
181 # define CPLAssert(expr) ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
183 # define CPLAssertAlwaysEval(expr) CPLAssert(expr)
186 # define CPLAssert(expr)
189 # define CPLAssertAlwaysEval(expr) CPL_IGNORE_RET_VAL(expr)
192 # define CPLAssertAlwaysEval(expr) (void)(expr)
203 # define VALIDATE_POINTER_ERR CE_Fatal
205 # define VALIDATE_POINTER_ERR CE_Failure
209 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) && !defined(DOXYGEN_SKIP)
216 class CPLErrorHandlerPusher
219 explicit CPLErrorHandlerPusher(CPLErrorHandler hHandler)
224 CPLErrorHandlerPusher(CPLErrorHandler hHandler,
void* user_data)
229 ~CPLErrorHandlerPusher()
235 class CPLErrorStateBackuper
237 CPLErrorNum m_nLastErrorNum;
238 CPLErr m_nLastErrorType;
239 std::string m_osLastErrorMsg;
242 CPLErrorStateBackuper() :
248 ~CPLErrorStateBackuper()
251 m_osLastErrorMsg.c_str());
257 #ifdef GDAL_COMPILATION
259 bool CPLIsDefaultErrorHandlerAndCatchDebug();
267 #define VALIDATE_POINTER0(ptr, func) \
268 do { if( CPL_NULLPTR == ptr ) \
270 CPLErr const ret = VALIDATE_POINTER_ERR; \
271 CPLError( ret, CPLE_ObjectNull, \
272 "Pointer \'%s\' is NULL in \'%s\'.\n", #ptr, (func)); \
276 #define VALIDATE_POINTER1(ptr, func, rc) \
277 do { if( CPL_NULLPTR == ptr ) \
279 CPLErr const ret = VALIDATE_POINTER_ERR; \
280 CPLError( ret, CPLE_ObjectNull, \
281 "Pointer \'%s\' is NULL in \'%s\'.\n", #ptr, (func)); \
282 return (rc); }} while(0)
#define CPLE_FileIO
Definition: cpl_error.h:103
#define CPLE_AppDefined
Definition: cpl_error.h:99
void CPL_DLL CPLEmergencyError(const char *) CPL_NO_RETURN
Definition: cpl_error.cpp:489
#define CPLE_AWSBucketNotFound
Definition: cpl_error.h:125
void CPL_DLL CPL_STDCALL CPLLoggingErrorHandler(CPLErr, CPLErrorNum, const char *)
Definition: cpl_error.cpp:982
CPLErr CPL_DLL CPL_STDCALL CPLGetLastErrorType(void)
Definition: cpl_error.cpp:842
void CPL_DLL CPL_STDCALL void CPL_DLL CPL_STDCALL _CPLAssert(const char *, const char *, int) CPL_NO_RETURN
Definition: cpl_error.cpp:1315
void CPL_DLL CPL_STDCALL CPLPushErrorHandler(CPLErrorHandler)
Definition: cpl_error.cpp:1185
void CPLTurnFailureIntoWarning(int bOn)
Definition: cpl_error.cpp:1058
const char CPL_DLL *CPL_STDCALL CPLGetLastErrorMsg(void)
Definition: cpl_error.cpp:866
#define CPLE_OpenFailed
Definition: cpl_error.h:105
unsigned int GUInt32
Definition: cpl_port.h:207
#define CPLE_NoWriteAccess
Definition: cpl_error.h:113
void CPL_DLL *CPL_STDCALL CPLGetErrorHandlerUserData(void)
Definition: cpl_error.cpp:186
#define CPLE_ObjectNull
Definition: cpl_error.h:117
CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandler(CPLErrorHandler)
Definition: cpl_error.cpp:1164
#define CPLE_UserInterrupt
Definition: cpl_error.h:115
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Definition: cpl_port.h:914
#define CPL_NO_RETURN
Definition: cpl_port.h:956
#define CPLE_HttpResponse
Definition: cpl_error.h:123
CPLErrorNum CPL_DLL CPL_STDCALL CPLGetLastErrorNo(void)
Definition: cpl_error.cpp:818
CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandlerEx(CPLErrorHandler, void *)
Definition: cpl_error.cpp:1090
#define CPLE_AWSSignatureDoesNotMatch
Definition: cpl_error.h:133
#define CPLE_OutOfMemory
Definition: cpl_error.h:101
#define CPLE_NotSupported
Definition: cpl_error.h:109
void(CPL_STDCALL * CPLErrorHandler)(CPLErr, CPLErrorNum, const char *)
Definition: cpl_error.h:156
#define CPLE_AWSAccessDenied
Definition: cpl_error.h:129
GUInt32 CPL_DLL CPL_STDCALL CPLGetErrorCounter(void)
Definition: cpl_error.cpp:889
#define CPLE_AWSObjectNotFound
Definition: cpl_error.h:127
void CPL_DLL CPL_STDCALL CPLSetCurrentErrorHandlerCatchDebug(int bCatchDebug)
Definition: cpl_error.cpp:1281
#define CPLE_AWSInvalidCredentials
Definition: cpl_error.h:131
void CPL_DLL CPL_STDCALL CPLQuietErrorHandler(CPLErr, CPLErrorNum, const char *)
Definition: cpl_error.cpp:967
int CPLErrorNum
Definition: cpl_error.h:94
void CPL_DLL CPL_STDCALL CPLPushErrorHandlerEx(CPLErrorHandler, void *)
Definition: cpl_error.cpp:1208
void CPL_DLL CPL_STDCALL CPLErrorReset(void)
Definition: cpl_error.cpp:729
#define CPLE_AssertionFailed
Definition: cpl_error.h:111
#define CPL_FORMAT_STRING(arg)
Definition: cpl_port.h:929
void CPL_DLL CPLErrorSetState(CPLErr eErrClass, CPLErrorNum err_no, const char *pszMsg)
Definition: cpl_error.cpp:764
void CPL_DLL void CPL_DLL CPLErrorV(CPLErr, CPLErrorNum, const char *, va_list)
Definition: cpl_error.cpp:324
void CPL_DLL CPL_STDCALL CPLPopErrorHandler(void)
Definition: cpl_error.cpp:1242
#define CPLE_None
Definition: cpl_error.h:97
void CPL_DLL CPL_STDCALL CPLDefaultErrorHandler(CPLErr, CPLErrorNum, const char *)
Definition: cpl_error.cpp:903
CPLErr
Definition: cpl_error.h:52
#define CPLE_IllegalArg
Definition: cpl_error.h:107