Sirius  0.0.0
error_code.h
Go to the documentation of this file.
1 
22 #ifndef SIRIUS_GDAL_ERROR_CODE_H_
23 #define SIRIUS_GDAL_ERROR_CODE_H_
24 
25 #include <system_error>
26 
27 #include <cpl_error.h>
28 
29 // This implementation is inspired by
30 // https://akrzemi1.wordpress.com/2017/07/12/your-own-error-code/
31 
32 namespace sirius {
33 namespace gdal {
34 
38 enum class ErrorCode {
39  kNone = CPLE_None,
40  kAppDefined = CPLE_AppDefined,
41  kOutOfMemory = CPLE_OutOfMemory,
42  kFileIO = CPLE_FileIO,
43  kOpenFailed = CPLE_OpenFailed,
44  kIllegalArg = CPLE_IllegalArg,
45  kNotSupported = CPLE_NotSupported,
46  kAssertionFailed = CPLE_AssertionFailed,
47  kNoWriteAccess = CPLE_NoWriteAccess,
48  kUserInterrupt = CPLE_UserInterrupt,
49  kObjectNull = CPLE_ObjectNull,
50  kHttpResponse = CPLE_HttpResponse,
51  kAWSBucketNotFound = CPLE_AWSBucketNotFound,
52  kAWSObjectNotFound = CPLE_AWSObjectNotFound,
53  kAWSAccessDenied = CPLE_AWSAccessDenied,
54  kAWSInvalidCredentials = CPLE_AWSInvalidCredentials,
55  kAWSSignatureDoesNotMatch = CPLE_AWSSignatureDoesNotMatch,
56 };
57 
65 std::error_code make_error_code(::CPLErrorNum errc);
66 
67 } // namespace gdal
68 } // namespace sirius
69 
70 namespace std {
71 
72 template <>
73 struct is_error_code_enum<sirius::gdal::ErrorCode> : std::true_type {};
74 
75 } // namespace std
76 
77 #endif // SIRIUS_GDAL_ERROR_CODE_H_
Definition: exception.h:27
Definition: error_code.h:70
std::error_code make_error_code(::CPLErrorNum errc)
Make an error code from ::CPLErrorNum enum.
ErrorCode
Enum of gdal error codes.
Definition: error_code.h:38