root / qerror.h @ 124964b5
History | View | Annotate | Download (5 kB)
1 | 9f9daf9a | Luiz Capitulino | /*
|
---|---|---|---|
2 | 41836a9f | Luiz Capitulino | * QError Module
|
3 | 9f9daf9a | Luiz Capitulino | *
|
4 | 9f9daf9a | Luiz Capitulino | * Copyright (C) 2009 Red Hat Inc.
|
5 | 9f9daf9a | Luiz Capitulino | *
|
6 | 9f9daf9a | Luiz Capitulino | * Authors:
|
7 | 9f9daf9a | Luiz Capitulino | * Luiz Capitulino <lcapitulino@redhat.com>
|
8 | 9f9daf9a | Luiz Capitulino | *
|
9 | 9f9daf9a | Luiz Capitulino | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
10 | 9f9daf9a | Luiz Capitulino | * See the COPYING.LIB file in the top-level directory.
|
11 | 9f9daf9a | Luiz Capitulino | */
|
12 | 9f9daf9a | Luiz Capitulino | #ifndef QERROR_H
|
13 | 9f9daf9a | Luiz Capitulino | #define QERROR_H
|
14 | 9f9daf9a | Luiz Capitulino | |
15 | 9f9daf9a | Luiz Capitulino | #include "qdict.h" |
16 | 77e595e7 | Markus Armbruster | #include "qstring.h" |
17 | 827b0813 | Markus Armbruster | #include "qemu-error.h" |
18 | 9f9daf9a | Luiz Capitulino | #include <stdarg.h> |
19 | 9f9daf9a | Luiz Capitulino | |
20 | 9f9daf9a | Luiz Capitulino | typedef struct QErrorStringTable { |
21 | 9f9daf9a | Luiz Capitulino | const char *desc; |
22 | 9f9daf9a | Luiz Capitulino | const char *error_fmt; |
23 | 9f9daf9a | Luiz Capitulino | } QErrorStringTable; |
24 | 9f9daf9a | Luiz Capitulino | |
25 | 9f9daf9a | Luiz Capitulino | typedef struct QError { |
26 | 9f9daf9a | Luiz Capitulino | QObject_HEAD; |
27 | 9f9daf9a | Luiz Capitulino | QDict *error; |
28 | 827b0813 | Markus Armbruster | Location loc; |
29 | 9f9daf9a | Luiz Capitulino | int linenr;
|
30 | 9f9daf9a | Luiz Capitulino | const char *file; |
31 | 9f9daf9a | Luiz Capitulino | const char *func; |
32 | 9f9daf9a | Luiz Capitulino | const QErrorStringTable *entry;
|
33 | 9f9daf9a | Luiz Capitulino | } QError; |
34 | 9f9daf9a | Luiz Capitulino | |
35 | 9f9daf9a | Luiz Capitulino | QError *qerror_new(void);
|
36 | 9f9daf9a | Luiz Capitulino | QError *qerror_from_info(const char *file, int linenr, const char *func, |
37 | 9f9daf9a | Luiz Capitulino | const char *fmt, va_list *va); |
38 | 77e595e7 | Markus Armbruster | QString *qerror_human(const QError *qerror);
|
39 | 827b0813 | Markus Armbruster | void qerror_print(QError *qerror);
|
40 | 0167f772 | Markus Armbruster | void qerror_report_internal(const char *file, int linenr, const char *func, |
41 | 0167f772 | Markus Armbruster | const char *fmt, ...) |
42 | 0167f772 | Markus Armbruster | __attribute__ ((format(printf, 4, 5))); |
43 | 0167f772 | Markus Armbruster | #define qerror_report(fmt, ...) \
|
44 | 0167f772 | Markus Armbruster | qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__) |
45 | 9f9daf9a | Luiz Capitulino | QError *qobject_to_qerror(const QObject *obj);
|
46 | 9f9daf9a | Luiz Capitulino | |
47 | 9f9daf9a | Luiz Capitulino | /*
|
48 | 9f9daf9a | Luiz Capitulino | * QError class list
|
49 | 9d494c4b | Markus Armbruster | * Please keep the definitions in alphabetical order.
|
50 | 9d494c4b | Markus Armbruster | * Use "grep '^#define QERR_' qerror.h | sort -c" to check.
|
51 | 9f9daf9a | Luiz Capitulino | */
|
52 | 56e9f563 | Markus Armbruster | #define QERR_BAD_BUS_FOR_DEVICE \
|
53 | 56e9f563 | Markus Armbruster | "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
|
54 | 56e9f563 | Markus Armbruster | |
55 | 7bbd8237 | Markus Armbruster | #define QERR_BUS_NOT_FOUND \
|
56 | 7bbd8237 | Markus Armbruster | "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
|
57 | 7bbd8237 | Markus Armbruster | |
58 | 8eae73b5 | Markus Armbruster | #define QERR_BUS_NO_HOTPLUG \
|
59 | 8eae73b5 | Markus Armbruster | "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
|
60 | 8eae73b5 | Markus Armbruster | |
61 | 4b9d4683 | Luiz Capitulino | #define QERR_COMMAND_NOT_FOUND \
|
62 | e16a1812 | Markus Armbruster | "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
|
63 | 4b9d4683 | Luiz Capitulino | |
64 | 0df37c41 | Luiz Capitulino | #define QERR_DEVICE_ENCRYPTED \
|
65 | e16a1812 | Markus Armbruster | "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
|
66 | 9f9daf9a | Luiz Capitulino | |
67 | 4d9a1a15 | Markus Armbruster | #define QERR_DEVICE_INIT_FAILED \
|
68 | 4d9a1a15 | Markus Armbruster | "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
|
69 | 4d9a1a15 | Markus Armbruster | |
70 | 5124eb59 | Markus Armbruster | #define QERR_DEVICE_IN_USE \
|
71 | 5124eb59 | Markus Armbruster | "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
|
72 | 5124eb59 | Markus Armbruster | |
73 | fc5469d8 | Markus Armbruster | #define QERR_DEVICE_LOCKED \
|
74 | b0868380 | Markus Armbruster | "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
|
75 | b0868380 | Markus Armbruster | |
76 | 1ae78718 | Markus Armbruster | #define QERR_DEVICE_MULTIPLE_BUSSES \
|
77 | 1ae78718 | Markus Armbruster | "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
|
78 | 1ae78718 | Markus Armbruster | |
79 | 055f6122 | Luiz Capitulino | #define QERR_DEVICE_NOT_ACTIVE \
|
80 | e16a1812 | Markus Armbruster | "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
|
81 | e16a1812 | Markus Armbruster | |
82 | 9d494c4b | Markus Armbruster | #define QERR_DEVICE_NOT_ENCRYPTED \
|
83 | 9d494c4b | Markus Armbruster | "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
|
84 | 9d494c4b | Markus Armbruster | |
85 | e16a1812 | Markus Armbruster | #define QERR_DEVICE_NOT_FOUND \
|
86 | e16a1812 | Markus Armbruster | "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
|
87 | 055f6122 | Luiz Capitulino | |
88 | 5cfe0264 | Markus Armbruster | #define QERR_DEVICE_NOT_REMOVABLE \
|
89 | 5cfe0264 | Markus Armbruster | "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
|
90 | 5cfe0264 | Markus Armbruster | |
91 | 07574baf | Markus Armbruster | #define QERR_DEVICE_NO_BUS \
|
92 | 07574baf | Markus Armbruster | "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
|
93 | 07574baf | Markus Armbruster | |
94 | 7bc84017 | Markus Armbruster | #define QERR_DUPLICATE_ID \
|
95 | 7bc84017 | Markus Armbruster | "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
|
96 | 7bc84017 | Markus Armbruster | |
97 | c7c338c4 | Markus Armbruster | #define QERR_FD_NOT_FOUND \
|
98 | bd9d3064 | Markus Armbruster | "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
|
99 | c7c338c4 | Markus Armbruster | |
100 | 41471a23 | Markus Armbruster | #define QERR_FD_NOT_SUPPLIED \
|
101 | bd9d3064 | Markus Armbruster | "{ 'class': 'FdNotSupplied', 'data': {} }"
|
102 | 41471a23 | Markus Armbruster | |
103 | 17901e75 | Markus Armbruster | #define QERR_INVALID_BLOCK_FORMAT \
|
104 | 17901e75 | Markus Armbruster | "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
|
105 | 17901e75 | Markus Armbruster | |
106 | 7a046f5f | Markus Armbruster | #define QERR_INVALID_PARAMETER \
|
107 | bd9d3064 | Markus Armbruster | "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
|
108 | 7a046f5f | Markus Armbruster | |
109 | 4b9d4683 | Luiz Capitulino | #define QERR_INVALID_PARAMETER_TYPE \
|
110 | e16a1812 | Markus Armbruster | "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
|
111 | 4b9d4683 | Luiz Capitulino | |
112 | 985a3e52 | Markus Armbruster | #define QERR_INVALID_PARAMETER_VALUE \
|
113 | 985a3e52 | Markus Armbruster | "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
|
114 | 985a3e52 | Markus Armbruster | |
115 | f6d855c5 | Luiz Capitulino | #define QERR_INVALID_PASSWORD \
|
116 | e16a1812 | Markus Armbruster | "{ 'class': 'InvalidPassword', 'data': {} }"
|
117 | e16a1812 | Markus Armbruster | |
118 | e16a1812 | Markus Armbruster | #define QERR_JSON_PARSING \
|
119 | e16a1812 | Markus Armbruster | "{ 'class': 'JSONParsing', 'data': {} }"
|
120 | f6d855c5 | Luiz Capitulino | |
121 | 82a60711 | Luiz Capitulino | #define QERR_KVM_MISSING_CAP \
|
122 | e16a1812 | Markus Armbruster | "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
|
123 | 82a60711 | Luiz Capitulino | |
124 | 4b9d4683 | Luiz Capitulino | #define QERR_MISSING_PARAMETER \
|
125 | e16a1812 | Markus Armbruster | "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
|
126 | 4b9d4683 | Luiz Capitulino | |
127 | fab5767f | Markus Armbruster | #define QERR_NO_BUS_FOR_DEVICE \
|
128 | fab5767f | Markus Armbruster | "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
|
129 | fab5767f | Markus Armbruster | |
130 | fc5469d8 | Markus Armbruster | #define QERR_OPEN_FILE_FAILED \
|
131 | fc5469d8 | Markus Armbruster | "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
|
132 | fc5469d8 | Markus Armbruster | |
133 | c58a35f8 | Markus Armbruster | #define QERR_PROPERTY_NOT_FOUND \
|
134 | c58a35f8 | Markus Armbruster | "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
|
135 | c58a35f8 | Markus Armbruster | |
136 | 06b4a703 | Markus Armbruster | #define QERR_PROPERTY_VALUE_BAD \
|
137 | 06b4a703 | Markus Armbruster | "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
138 | 06b4a703 | Markus Armbruster | |
139 | 9c5eff95 | Markus Armbruster | #define QERR_PROPERTY_VALUE_IN_USE \
|
140 | 9c5eff95 | Markus Armbruster | "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
141 | 9c5eff95 | Markus Armbruster | |
142 | 84745d68 | Markus Armbruster | #define QERR_PROPERTY_VALUE_NOT_FOUND \
|
143 | 84745d68 | Markus Armbruster | "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
144 | 84745d68 | Markus Armbruster | |
145 | 4b9d4683 | Luiz Capitulino | #define QERR_QMP_BAD_INPUT_OBJECT \
|
146 | e16a1812 | Markus Armbruster | "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
|
147 | 4b9d4683 | Luiz Capitulino | |
148 | 7dfb6123 | Luiz Capitulino | #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
|
149 | 7dfb6123 | Luiz Capitulino | "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
|
150 | 7dfb6123 | Luiz Capitulino | |
151 | 7a84cb23 | Markus Armbruster | #define QERR_SET_PASSWD_FAILED \
|
152 | 7a84cb23 | Markus Armbruster | "{ 'class': 'SetPasswdFailed', 'data': {} }"
|
153 | 7a84cb23 | Markus Armbruster | |
154 | a488be27 | Markus Armbruster | #define QERR_TOO_MANY_FILES \
|
155 | bd9d3064 | Markus Armbruster | "{ 'class': 'TooManyFiles', 'data': {} }"
|
156 | a488be27 | Markus Armbruster | |
157 | fc5469d8 | Markus Armbruster | #define QERR_UNDEFINED_ERROR \
|
158 | fc5469d8 | Markus Armbruster | "{ 'class': 'UndefinedError', 'data': {} }"
|
159 | fc5469d8 | Markus Armbruster | |
160 | a6906e31 | Markus Armbruster | #define QERR_VNC_SERVER_FAILED \
|
161 | a6906e31 | Markus Armbruster | "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
|
162 | a6906e31 | Markus Armbruster | |
163 | 9f9daf9a | Luiz Capitulino | #endif /* QERROR_H */ |