]>
Commit | Line | Data |
---|---|---|
9f9daf9a | 1 | /* |
41836a9f | 2 | * QError Module |
9f9daf9a LC |
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" |
827b0813 | 17 | #include "qemu-error.h" |
2a82d936 | 18 | #include "error.h" |
9f9daf9a LC |
19 | #include <stdarg.h> |
20 | ||
21 | typedef struct QErrorStringTable { | |
22 | const char *desc; | |
23 | const char *error_fmt; | |
24 | } QErrorStringTable; | |
25 | ||
26 | typedef struct QError { | |
27 | QObject_HEAD; | |
28 | QDict *error; | |
827b0813 | 29 | Location loc; |
18da7c0f | 30 | char *err_msg; |
9f9daf9a LC |
31 | } QError; |
32 | ||
77e595e7 | 33 | QString *qerror_human(const QError *qerror); |
5f0f0e13 | 34 | void qerror_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); |
2a82d936 | 35 | void qerror_report_err(Error *err); |
59f971d4 | 36 | void assert_no_error(Error *err); |
2b38cf2e | 37 | char *qerror_format(const char *fmt, QDict *error); |
9f9daf9a LC |
38 | |
39 | /* | |
40 | * QError class list | |
9d494c4b | 41 | * Please keep the definitions in alphabetical order. |
9737383b | 42 | * Use scripts/check-qerror.sh to check. |
9f9daf9a | 43 | */ |
c1303596 SH |
44 | #define QERR_ADD_CLIENT_FAILED \ |
45 | "{ 'class': 'AddClientFailed', 'data': {} }" | |
46 | ||
11e35bfd PB |
47 | #define QERR_AMBIGUOUS_PATH \ |
48 | "{ 'class': 'AmbiguousPath', 'data': { 'path': %s } }" | |
49 | ||
56e9f563 MA |
50 | #define QERR_BAD_BUS_FOR_DEVICE \ |
51 | "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }" | |
52 | ||
019b8cbf MT |
53 | #define QERR_BASE_NOT_FOUND \ |
54 | "{ 'class': 'BaseNotFound', 'data': { 'base': %s } }" | |
55 | ||
1ed520c6 AL |
56 | #define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \ |
57 | "{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }" | |
58 | ||
c1303596 SH |
59 | #define QERR_BUFFER_OVERRUN \ |
60 | "{ 'class': 'BufferOverrun', 'data': {} }" | |
7bbd8237 | 61 | |
8eae73b5 MA |
62 | #define QERR_BUS_NO_HOTPLUG \ |
63 | "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }" | |
64 | ||
c1303596 SH |
65 | #define QERR_BUS_NOT_FOUND \ |
66 | "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }" | |
4b9d4683 | 67 | |
abd6cf6d MR |
68 | #define QERR_COMMAND_DISABLED \ |
69 | "{ 'class': 'CommandDisabled', 'data': { 'name': %s } }" | |
70 | ||
c1303596 SH |
71 | #define QERR_COMMAND_NOT_FOUND \ |
72 | "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }" | |
73 | ||
0df37c41 | 74 | #define QERR_DEVICE_ENCRYPTED \ |
903a8814 | 75 | "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s } }" |
9f9daf9a | 76 | |
c1303596 SH |
77 | #define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \ |
78 | "{ 'class': 'DeviceFeatureBlocksMigration', 'data': { 'device': %s, 'feature': %s } }" | |
79 | ||
939a1cc3 SH |
80 | #define QERR_DEVICE_HAS_NO_MEDIUM \ |
81 | "{ 'class': 'DeviceHasNoMedium', 'data': { 'device': %s } }" | |
82 | ||
4d9a1a15 MA |
83 | #define QERR_DEVICE_INIT_FAILED \ |
84 | "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }" | |
85 | ||
5124eb59 MA |
86 | #define QERR_DEVICE_IN_USE \ |
87 | "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }" | |
88 | ||
939a1cc3 SH |
89 | #define QERR_DEVICE_IS_READ_ONLY \ |
90 | "{ 'class': 'DeviceIsReadOnly', 'data': { 'device': %s } }" | |
91 | ||
fc5469d8 | 92 | #define QERR_DEVICE_LOCKED \ |
b0868380 MA |
93 | "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }" |
94 | ||
1ae78718 MA |
95 | #define QERR_DEVICE_MULTIPLE_BUSSES \ |
96 | "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }" | |
97 | ||
c1303596 SH |
98 | #define QERR_DEVICE_NO_BUS \ |
99 | "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }" | |
100 | ||
101 | #define QERR_DEVICE_NO_HOTPLUG \ | |
102 | "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }" | |
103 | ||
055f6122 | 104 | #define QERR_DEVICE_NOT_ACTIVE \ |
e16a1812 MA |
105 | "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }" |
106 | ||
9d494c4b MA |
107 | #define QERR_DEVICE_NOT_ENCRYPTED \ |
108 | "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }" | |
109 | ||
e16a1812 MA |
110 | #define QERR_DEVICE_NOT_FOUND \ |
111 | "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }" | |
055f6122 | 112 | |
5cfe0264 MA |
113 | #define QERR_DEVICE_NOT_REMOVABLE \ |
114 | "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }" | |
115 | ||
7bc84017 MA |
116 | #define QERR_DUPLICATE_ID \ |
117 | "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }" | |
118 | ||
c7c338c4 | 119 | #define QERR_FD_NOT_FOUND \ |
bd9d3064 | 120 | "{ 'class': 'FdNotFound', 'data': { 'name': %s } }" |
c7c338c4 | 121 | |
41471a23 | 122 | #define QERR_FD_NOT_SUPPLIED \ |
bd9d3064 | 123 | "{ 'class': 'FdNotSupplied', 'data': {} }" |
41471a23 | 124 | |
c1303596 SH |
125 | #define QERR_FEATURE_DISABLED \ |
126 | "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }" | |
127 | ||
17901e75 MA |
128 | #define QERR_INVALID_BLOCK_FORMAT \ |
129 | "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }" | |
130 | ||
8ff15d4a LC |
131 | #define QERR_INVALID_OPTION_GROUP \ |
132 | "{ 'class': 'InvalidOptionGroup', 'data': { 'group': %s } }" | |
133 | ||
7a046f5f | 134 | #define QERR_INVALID_PARAMETER \ |
bd9d3064 | 135 | "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }" |
7a046f5f | 136 | |
c1303596 SH |
137 | #define QERR_INVALID_PARAMETER_COMBINATION \ |
138 | "{ 'class': 'InvalidParameterCombination', 'data': {} }" | |
139 | ||
4b9d4683 | 140 | #define QERR_INVALID_PARAMETER_TYPE \ |
e16a1812 | 141 | "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }" |
4b9d4683 | 142 | |
985a3e52 MA |
143 | #define QERR_INVALID_PARAMETER_VALUE \ |
144 | "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }" | |
145 | ||
f6d855c5 | 146 | #define QERR_INVALID_PASSWORD \ |
e16a1812 MA |
147 | "{ 'class': 'InvalidPassword', 'data': {} }" |
148 | ||
58898873 LC |
149 | #define QERR_IO_ERROR \ |
150 | "{ 'class': 'IOError', 'data': {} }" | |
151 | ||
ef749d07 AL |
152 | #define QERR_JSON_PARSE_ERROR \ |
153 | "{ 'class': 'JSONParseError', 'data': { 'message': %s } }" | |
154 | ||
c1303596 SH |
155 | #define QERR_JSON_PARSING \ |
156 | "{ 'class': 'JSONParsing', 'data': {} }" | |
c40cc0a0 | 157 | |
82a60711 | 158 | #define QERR_KVM_MISSING_CAP \ |
e16a1812 | 159 | "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }" |
82a60711 | 160 | |
a4acc064 LC |
161 | #define QERR_MIGRATION_ACTIVE \ |
162 | "{ 'class': 'MigrationActive', 'data': {} }" | |
163 | ||
164 | #define QERR_MIGRATION_NOT_SUPPORTED \ | |
165 | "{ 'class': 'MigrationNotSupported', 'data': {'device': %s} }" | |
166 | ||
8e84865e AS |
167 | #define QERR_MIGRATION_EXPECTED \ |
168 | "{ 'class': 'MigrationExpected', 'data': {} }" | |
169 | ||
4b9d4683 | 170 | #define QERR_MISSING_PARAMETER \ |
e16a1812 | 171 | "{ 'class': 'MissingParameter', 'data': { 'name': %s } }" |
4b9d4683 | 172 | |
fab5767f MA |
173 | #define QERR_NO_BUS_FOR_DEVICE \ |
174 | "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }" | |
175 | ||
12bd451f SH |
176 | #define QERR_NOT_SUPPORTED \ |
177 | "{ 'class': 'NotSupported', 'data': {} }" | |
178 | ||
fc5469d8 MA |
179 | #define QERR_OPEN_FILE_FAILED \ |
180 | "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }" | |
181 | ||
44677ded AL |
182 | #define QERR_PERMISSION_DENIED \ |
183 | "{ 'class': 'PermissionDenied', 'data': {} }" | |
184 | ||
c58a35f8 MA |
185 | #define QERR_PROPERTY_NOT_FOUND \ |
186 | "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }" | |
187 | ||
06b4a703 MA |
188 | #define QERR_PROPERTY_VALUE_BAD \ |
189 | "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }" | |
190 | ||
9c5eff95 MA |
191 | #define QERR_PROPERTY_VALUE_IN_USE \ |
192 | "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }" | |
193 | ||
84745d68 MA |
194 | #define QERR_PROPERTY_VALUE_NOT_FOUND \ |
195 | "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }" | |
196 | ||
02fda01c SH |
197 | #define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \ |
198 | "{ 'class': 'PropertyValueNotPowerOf2', 'data': { " \ | |
199 | "'device': %s, 'property': %s, 'value': %"PRId64" } }" | |
200 | ||
6aced82c PB |
201 | #define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ |
202 | "{ 'class': 'PropertyValueOutOfRange', 'data': { 'device': %s, 'property': %s, 'value': %"PRId64", 'min': %"PRId64", 'max': %"PRId64" } }" | |
203 | ||
c1303596 SH |
204 | #define QERR_QGA_COMMAND_FAILED \ |
205 | "{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }" | |
206 | ||
207 | #define QERR_QGA_LOGGING_FAILED \ | |
208 | "{ 'class': 'QgaLoggingFailed', 'data': {} }" | |
209 | ||
4b9d4683 | 210 | #define QERR_QMP_BAD_INPUT_OBJECT \ |
e16a1812 | 211 | "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }" |
4b9d4683 | 212 | |
7dfb6123 LC |
213 | #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \ |
214 | "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }" | |
215 | ||
60d76d7b LC |
216 | #define QERR_QMP_EXTRA_MEMBER \ |
217 | "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }" | |
218 | ||
6667b23f LC |
219 | #define QERR_RESET_REQUIRED \ |
220 | "{ 'class': 'ResetRequired', 'data': {} }" | |
221 | ||
7a84cb23 MA |
222 | #define QERR_SET_PASSWD_FAILED \ |
223 | "{ 'class': 'SetPasswdFailed', 'data': {} }" | |
224 | ||
a488be27 | 225 | #define QERR_TOO_MANY_FILES \ |
bd9d3064 | 226 | "{ 'class': 'TooManyFiles', 'data': {} }" |
a488be27 | 227 | |
fc5469d8 MA |
228 | #define QERR_UNDEFINED_ERROR \ |
229 | "{ 'class': 'UndefinedError', 'data': {} }" | |
230 | ||
f54e3641 KW |
231 | #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \ |
232 | "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }" | |
233 | ||
c1303596 SH |
234 | #define QERR_UNSUPPORTED \ |
235 | "{ 'class': 'Unsupported', 'data': {} }" | |
236 | ||
e9a0152b AK |
237 | #define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \ |
238 | "{ 'class': 'VirtFSFeatureBlocksMigration', 'data': { 'path': %s, 'tag': %s } }" | |
239 | ||
a6906e31 MA |
240 | #define QERR_VNC_SERVER_FAILED \ |
241 | "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }" | |
242 | ||
aed3d11d AK |
243 | #define QERR_SOCKET_CONNECT_IN_PROGRESS \ |
244 | "{ 'class': 'SockConnectInprogress', 'data': {} }" | |
245 | ||
246 | #define QERR_SOCKET_CONNECT_FAILED \ | |
247 | "{ 'class': 'SockConnectFailed', 'data': {} }" | |
248 | ||
249 | #define QERR_SOCKET_LISTEN_FAILED \ | |
250 | "{ 'class': 'SockListenFailed', 'data': {} }" | |
251 | ||
252 | #define QERR_SOCKET_BIND_FAILED \ | |
253 | "{ 'class': 'SockBindFailed', 'data': {} }" | |
254 | ||
255 | #define QERR_SOCKET_CREATE_FAILED \ | |
256 | "{ 'class': 'SockCreateFailed', 'data': {} }" | |
257 | ||
9f9daf9a | 258 | #endif /* QERROR_H */ |