GDAL

cpl_vsi_error.h
1/******************************************************************************
2 * $Id$
3 *
4 * Project: VSI Virtual File System
5 * Purpose: Implement an error system for reporting file system errors.
6 * Filesystem errors need to be handled separately from the
7 * CPLError architecture because they are potentially ignored.
8 * Author: Rob Emanuele, rdemanuele at gmail.com
9 *
10 ******************************************************************************
11 * Copyright (c) 2016, Rob Emanuele <rdemanuele at gmail.com>
12 *
13 * SPDX-License-Identifier: MIT
14 ****************************************************************************/
15
16#ifndef CPL_VSI_ERROR_H_INCLUDED
17#define CPL_VSI_ERROR_H_INCLUDED
18
19#include "cpl_port.h"
20#include "cpl_error.h"
21
22/* ====================================================================
23 Filesystem error codes.
24 ==================================================================== */
25
26 CPL_C_START
27
28 typedef int VSIErrorNum;
29
30#define VSIE_None 0
31#define VSIE_FileError 1
32#define VSIE_HttpError 2
33
34#define VSIE_AWSError 5
35#define VSIE_AWSAccessDenied 6
36#define VSIE_AWSBucketNotFound 7
37#define VSIE_AWSObjectNotFound 8
38#define VSIE_AWSInvalidCredentials 9
39#define VSIE_AWSSignatureDoesNotMatch 10
40
41 void CPL_DLL VSIError(VSIErrorNum err_no, CPL_FORMAT_STRING(const char *fmt),
42 ...) CPL_PRINT_FUNC_FORMAT(2, 3);
43
44 void CPL_DLL CPL_STDCALL VSIErrorReset(void);
45VSIErrorNum CPL_DLL CPL_STDCALL VSIGetLastErrorNo(void);
46const char CPL_DLL *CPL_STDCALL VSIGetLastErrorMsg(void);
47
48 int CPL_DLL CPL_STDCALL VSIToCPLError(CPLErr eErrClass,
49 CPLErrorNum eDefaultErrorNo);
50 void CPL_DLL VSIToCPLErrorWithMsg(CPLErr eErrClass, CPLErrorNum eDefaultErrorNo,
51 const char *pszMsg);
52
53 CPL_C_END
54
55#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:79
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:283
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:279
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:954
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition cpl_port.h:938