GDAL

cpl_vsi_error.h
1/******************************************************************************
2 *
3 * Project: VSI Virtual File System
4 * Purpose: Implement an error system for reporting file system errors.
5 * Filesystem errors need to be handled separately from the
6 * CPLError architecture because they are potentially ignored.
7 * Author: Rob Emanuele, rdemanuele at gmail.com
8 *
9 ******************************************************************************
10 * Copyright (c) 2016, Rob Emanuele <rdemanuele at gmail.com>
11 *
12 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15#ifndef CPL_VSI_ERROR_H_INCLUDED
16#define CPL_VSI_ERROR_H_INCLUDED
17
18#include "cpl_port.h"
19#include "cpl_error.h"
20
21/* ====================================================================
22 Filesystem error codes.
23 ==================================================================== */
24
25 CPL_C_START
26
27 typedef int VSIErrorNum;
28
29#define VSIE_None 0
30#define VSIE_FileError 1
31#define VSIE_HttpError 2
32
33#define VSIE_ObjectStorageGenericError 5
34#define VSIE_AccessDenied 6
35#define VSIE_BucketNotFound 7
36#define VSIE_ObjectNotFound 8
37#define VSIE_InvalidCredentials 9
38#define VSIE_SignatureDoesNotMatch 10
39
44#define VSIE_AWSError VSIE_ObjectStorageGenericError
45
50#define VSIE_AWSAccessDenied VSIE_AccessDenied
51
56#define VSIE_AWSBucketNotFound VSIE_BucketNotFound
57
62#define VSIE_AWSObjectNotFound VSIE_ObjectNotFound
63
68#define VSIE_AWSInvalidCredentials VSIE_InvalidCredentials
69
74#define VSIE_AWSSignatureDoesNotMatch VSIE_SignatureDoesNotMatch
75
76 void CPL_DLL VSIError(VSIErrorNum err_no, CPL_FORMAT_STRING(const char *fmt),
77 ...) CPL_PRINT_FUNC_FORMAT(2, 3);
78
79 void CPL_DLL CPL_STDCALL VSIErrorReset(void);
80VSIErrorNum CPL_DLL CPL_STDCALL VSIGetLastErrorNo(void);
81const char CPL_DLL *CPL_STDCALL VSIGetLastErrorMsg(void);
82
83const char *VSIErrorNumToString(int eErr);
84 int CPL_DLL CPL_STDCALL VSIToCPLError(CPLErr eErrClass,
85 CPLErrorNum eDefaultErrorNo);
86 void CPL_DLL VSIToCPLErrorWithMsg(CPLErr eErrClass, CPLErrorNum eDefaultErrorNo,
87 const char *pszMsg);
88
89 CPL_C_END
90
91#endif /* CPL_VSI_ERROR_H_INCLUDED */
cpl_error.h
CPL error handling services.
CPLErr
CPLErr
Error category.
Definition cpl_error.h:37
CPLErrorNum
int CPLErrorNum
Error number.
Definition cpl_error.h:80
cpl_port.h
Core portability definitions for CPL.
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:289
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:285
CPL_FORMAT_STRING
#define CPL_FORMAT_STRING(arg)
Macro into which to wrap the format argument of a printf-like function.
Definition cpl_port.h:860
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition cpl_port.h:844