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 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32#ifndef CPL_VSI_ERROR_H_INCLUDED
33#define CPL_VSI_ERROR_H_INCLUDED
34
35#include "cpl_port.h"
36#include "cpl_error.h"
37
38/* ====================================================================
39 Filesystem error codes.
40 ==================================================================== */
41
42 CPL_C_START
43
44typedef int VSIErrorNum;
45
46#define VSIE_None 0
47#define VSIE_FileError 1
48#define VSIE_HttpError 2
49
50#define VSIE_AWSError 5
51#define VSIE_AWSAccessDenied 6
52#define VSIE_AWSBucketNotFound 7
53#define VSIE_AWSObjectNotFound 8
54#define VSIE_AWSInvalidCredentials 9
55#define VSIE_AWSSignatureDoesNotMatch 10
56
57void CPL_DLL VSIError(VSIErrorNum err_no, CPL_FORMAT_STRING(const char *fmt),
58 ...) CPL_PRINT_FUNC_FORMAT(2, 3);
59
60void CPL_DLL CPL_STDCALL VSIErrorReset(void);
61VSIErrorNum CPL_DLL CPL_STDCALL VSIGetLastErrorNo(void);
62const char CPL_DLL *CPL_STDCALL VSIGetLastErrorMsg(void);
63
64int CPL_DLL CPL_STDCALL VSIToCPLError(CPLErr eErrClass,
65 CPLErrorNum eDefaultErrorNo);
66
67 CPL_C_END
68
69#endif /* CPL_VSI_ERROR_H_INCLUDED */
cpl_error.h
CPL error handling services.
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:53
CPLErrorNum
int CPLErrorNum
Error number.
Definition: cpl_error.h:95
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:299
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:295
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:966
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:950