]>
Commit | Line | Data |
---|---|---|
9f9daf9a LC |
1 | /* |
2 | * QError header file. | |
3 | * | |
4 | * Copyright (C) 2009 Red Hat Inc. | |
5 | * | |
6 | * Authors: | |
7 | * Luiz Capitulino <[email protected]> | |
8 | * | |
9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. | |
10 | * See the COPYING.LIB file in the top-level directory. | |
11 | */ | |
12 | #ifndef QERROR_H | |
13 | #define QERROR_H | |
14 | ||
15 | #include "qdict.h" | |
77e595e7 | 16 | #include "qstring.h" |
9f9daf9a LC |
17 | #include <stdarg.h> |
18 | ||
19 | typedef struct QErrorStringTable { | |
20 | const char *desc; | |
21 | const char *error_fmt; | |
22 | } QErrorStringTable; | |
23 | ||
24 | typedef struct QError { | |
25 | QObject_HEAD; | |
26 | QDict *error; | |
27 | int linenr; | |
28 | const char *file; | |
29 | const char *func; | |
30 | const QErrorStringTable *entry; | |
31 | } QError; | |
32 | ||
33 | QError *qerror_new(void); | |
34 | QError *qerror_from_info(const char *file, int linenr, const char *func, | |
35 | const char *fmt, va_list *va); | |
77e595e7 | 36 | QString *qerror_human(const QError *qerror); |
9f9daf9a LC |
37 | void qerror_print(const QError *qerror); |
38 | QError *qobject_to_qerror(const QObject *obj); | |
39 | ||
40 | /* | |
41 | * QError class list | |
42 | */ | |
4b9d4683 | 43 | #define QERR_COMMAND_NOT_FOUND \ |
e16a1812 | 44 | "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }" |
4b9d4683 | 45 | |
0df37c41 | 46 | #define QERR_DEVICE_ENCRYPTED \ |
e16a1812 | 47 | "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }" |
9f9daf9a | 48 | |
b0868380 MA |
49 | #define QERR_DEVICE_LOCKED \ |
50 | "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }" | |
51 | ||
055f6122 | 52 | #define QERR_DEVICE_NOT_ACTIVE \ |
e16a1812 MA |
53 | "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }" |
54 | ||
55 | #define QERR_DEVICE_NOT_FOUND \ | |
56 | "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }" | |
055f6122 | 57 | |
5cfe0264 MA |
58 | #define QERR_DEVICE_NOT_REMOVABLE \ |
59 | "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }" | |
60 | ||
c7c338c4 | 61 | #define QERR_FD_NOT_FOUND \ |
bd9d3064 | 62 | "{ 'class': 'FdNotFound', 'data': { 'name': %s } }" |
c7c338c4 | 63 | |
41471a23 | 64 | #define QERR_FD_NOT_SUPPLIED \ |
bd9d3064 | 65 | "{ 'class': 'FdNotSupplied', 'data': {} }" |
41471a23 | 66 | |
3da2c808 MA |
67 | #define QERR_OPEN_FILE_FAILED \ |
68 | "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }" | |
69 | ||
17901e75 MA |
70 | #define QERR_INVALID_BLOCK_FORMAT \ |
71 | "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }" | |
72 | ||
7a046f5f | 73 | #define QERR_INVALID_PARAMETER \ |
bd9d3064 | 74 | "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }" |
7a046f5f | 75 | |
4b9d4683 | 76 | #define QERR_INVALID_PARAMETER_TYPE \ |
e16a1812 | 77 | "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }" |
4b9d4683 | 78 | |
f6d855c5 | 79 | #define QERR_INVALID_PASSWORD \ |
e16a1812 MA |
80 | "{ 'class': 'InvalidPassword', 'data': {} }" |
81 | ||
82 | #define QERR_JSON_PARSING \ | |
83 | "{ 'class': 'JSONParsing', 'data': {} }" | |
f6d855c5 | 84 | |
82a60711 | 85 | #define QERR_KVM_MISSING_CAP \ |
e16a1812 | 86 | "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }" |
82a60711 | 87 | |
4b9d4683 | 88 | #define QERR_MISSING_PARAMETER \ |
e16a1812 | 89 | "{ 'class': 'MissingParameter', 'data': { 'name': %s } }" |
4b9d4683 LC |
90 | |
91 | #define QERR_QMP_BAD_INPUT_OBJECT \ | |
e16a1812 | 92 | "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }" |
4b9d4683 | 93 | |
7a84cb23 MA |
94 | #define QERR_SET_PASSWD_FAILED \ |
95 | "{ 'class': 'SetPasswdFailed', 'data': {} }" | |
96 | ||
4b9d4683 | 97 | #define QERR_UNDEFINED_ERROR \ |
e16a1812 | 98 | "{ 'class': 'UndefinedError', 'data': {} }" |
4b9d4683 | 99 | |
a488be27 | 100 | #define QERR_TOO_MANY_FILES \ |
bd9d3064 | 101 | "{ 'class': 'TooManyFiles', 'data': {} }" |
a488be27 | 102 | |
a6906e31 MA |
103 | #define QERR_VNC_SERVER_FAILED \ |
104 | "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }" | |
105 | ||
9f9daf9a | 106 | #endif /* QERROR_H */ |