qapi: don't convert enum strings to lowercase
[qemu/ar7.git] / qerror.h
blob52ce58dbc28cefa4b3f9178701d8525d1d325fa7
1 /*
2 * QError Module
4 * Copyright (C) 2009 Red Hat Inc.
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
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.
12 #ifndef QERROR_H
13 #define QERROR_H
15 #include "qdict.h"
16 #include "qstring.h"
17 #include "qemu-error.h"
18 #include "error.h"
19 #include <stdarg.h>
21 typedef struct QErrorStringTable {
22 const char *desc;
23 const char *error_fmt;
24 } QErrorStringTable;
26 typedef struct QError {
27 QObject_HEAD;
28 QDict *error;
29 Location loc;
30 char *err_msg;
31 } QError;
33 QString *qerror_human(const QError *qerror);
34 void qerror_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
35 void qerror_report_err(Error *err);
36 void assert_no_error(Error *err);
37 char *qerror_format(const char *fmt, QDict *error);
40 * QError class list
41 * Please keep the definitions in alphabetical order.
42 * Use scripts/check-qerror.sh to check.
44 #define QERR_ADD_CLIENT_FAILED \
45 "{ 'class': 'AddClientFailed', 'data': {} }"
47 #define QERR_AMBIGUOUS_PATH \
48 "{ 'class': 'AmbiguousPath', 'data': { 'path': %s } }"
50 #define QERR_BAD_BUS_FOR_DEVICE \
51 "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
53 #define QERR_BASE_NOT_FOUND \
54 "{ 'class': 'BaseNotFound', 'data': { 'base': %s } }"
56 #define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
57 "{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }"
59 #define QERR_BUFFER_OVERRUN \
60 "{ 'class': 'BufferOverrun', 'data': {} }"
62 #define QERR_BUS_NO_HOTPLUG \
63 "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
65 #define QERR_BUS_NOT_FOUND \
66 "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
68 #define QERR_COMMAND_DISABLED \
69 "{ 'class': 'CommandDisabled', 'data': { 'name': %s } }"
71 #define QERR_COMMAND_NOT_FOUND \
72 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
74 #define QERR_DEVICE_ENCRYPTED \
75 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s } }"
77 #define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
78 "{ 'class': 'DeviceFeatureBlocksMigration', 'data': { 'device': %s, 'feature': %s } }"
80 #define QERR_DEVICE_HAS_NO_MEDIUM \
81 "{ 'class': 'DeviceHasNoMedium', 'data': { 'device': %s } }"
83 #define QERR_DEVICE_INIT_FAILED \
84 "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
86 #define QERR_DEVICE_IN_USE \
87 "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
89 #define QERR_DEVICE_IS_READ_ONLY \
90 "{ 'class': 'DeviceIsReadOnly', 'data': { 'device': %s } }"
92 #define QERR_DEVICE_LOCKED \
93 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
95 #define QERR_DEVICE_MULTIPLE_BUSSES \
96 "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
98 #define QERR_DEVICE_NO_BUS \
99 "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
101 #define QERR_DEVICE_NO_HOTPLUG \
102 "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
104 #define QERR_DEVICE_NOT_ACTIVE \
105 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
107 #define QERR_DEVICE_NOT_ENCRYPTED \
108 "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
110 #define QERR_DEVICE_NOT_FOUND \
111 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
113 #define QERR_DEVICE_NOT_REMOVABLE \
114 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
116 #define QERR_DUPLICATE_ID \
117 "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
119 #define QERR_FD_NOT_FOUND \
120 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
122 #define QERR_FD_NOT_SUPPLIED \
123 "{ 'class': 'FdNotSupplied', 'data': {} }"
125 #define QERR_FEATURE_DISABLED \
126 "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
128 #define QERR_INVALID_BLOCK_FORMAT \
129 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
131 #define QERR_INVALID_OPTION_GROUP \
132 "{ 'class': 'InvalidOptionGroup', 'data': { 'group': %s } }"
134 #define QERR_INVALID_PARAMETER \
135 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
137 #define QERR_INVALID_PARAMETER_COMBINATION \
138 "{ 'class': 'InvalidParameterCombination', 'data': {} }"
140 #define QERR_INVALID_PARAMETER_TYPE \
141 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
143 #define QERR_INVALID_PARAMETER_VALUE \
144 "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
146 #define QERR_INVALID_PASSWORD \
147 "{ 'class': 'InvalidPassword', 'data': {} }"
149 #define QERR_IO_ERROR \
150 "{ 'class': 'IOError', 'data': {} }"
152 #define QERR_JSON_PARSE_ERROR \
153 "{ 'class': 'JSONParseError', 'data': { 'message': %s } }"
155 #define QERR_JSON_PARSING \
156 "{ 'class': 'JSONParsing', 'data': {} }"
158 #define QERR_KVM_MISSING_CAP \
159 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
161 #define QERR_MIGRATION_ACTIVE \
162 "{ 'class': 'MigrationActive', 'data': {} }"
164 #define QERR_MIGRATION_NOT_SUPPORTED \
165 "{ 'class': 'MigrationNotSupported', 'data': {'device': %s} }"
167 #define QERR_MIGRATION_EXPECTED \
168 "{ 'class': 'MigrationExpected', 'data': {} }"
170 #define QERR_MISSING_PARAMETER \
171 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
173 #define QERR_NO_BUS_FOR_DEVICE \
174 "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
176 #define QERR_NOT_SUPPORTED \
177 "{ 'class': 'NotSupported', 'data': {} }"
179 #define QERR_OPEN_FILE_FAILED \
180 "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
182 #define QERR_PERMISSION_DENIED \
183 "{ 'class': 'PermissionDenied', 'data': {} }"
185 #define QERR_PROPERTY_NOT_FOUND \
186 "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
188 #define QERR_PROPERTY_VALUE_BAD \
189 "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
191 #define QERR_PROPERTY_VALUE_IN_USE \
192 "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
194 #define QERR_PROPERTY_VALUE_NOT_FOUND \
195 "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
197 #define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \
198 "{ 'class': 'PropertyValueNotPowerOf2', 'data': { " \
199 "'device': %s, 'property': %s, 'value': %"PRId64" } }"
201 #define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
202 "{ 'class': 'PropertyValueOutOfRange', 'data': { 'device': %s, 'property': %s, 'value': %"PRId64", 'min': %"PRId64", 'max': %"PRId64" } }"
204 #define QERR_QGA_COMMAND_FAILED \
205 "{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }"
207 #define QERR_QGA_LOGGING_FAILED \
208 "{ 'class': 'QgaLoggingFailed', 'data': {} }"
210 #define QERR_QMP_BAD_INPUT_OBJECT \
211 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
213 #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
214 "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
216 #define QERR_QMP_EXTRA_MEMBER \
217 "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
219 #define QERR_RESET_REQUIRED \
220 "{ 'class': 'ResetRequired', 'data': {} }"
222 #define QERR_SET_PASSWD_FAILED \
223 "{ 'class': 'SetPasswdFailed', 'data': {} }"
225 #define QERR_TOO_MANY_FILES \
226 "{ 'class': 'TooManyFiles', 'data': {} }"
228 #define QERR_UNDEFINED_ERROR \
229 "{ 'class': 'UndefinedError', 'data': {} }"
231 #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
232 "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
234 #define QERR_UNSUPPORTED \
235 "{ 'class': 'Unsupported', 'data': {} }"
237 #define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \
238 "{ 'class': 'VirtFSFeatureBlocksMigration', 'data': { 'path': %s, 'tag': %s } }"
240 #define QERR_VNC_SERVER_FAILED \
241 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
243 #define QERR_SOCKET_CONNECT_FAILED \
244 "{ 'class': 'SockConnectFailed', 'data': {} }"
246 #define QERR_SOCKET_LISTEN_FAILED \
247 "{ 'class': 'SockListenFailed', 'data': {} }"
249 #define QERR_SOCKET_BIND_FAILED \
250 "{ 'class': 'SockBindFailed', 'data': {} }"
252 #define QERR_SOCKET_CREATE_FAILED \
253 "{ 'class': 'SockCreateFailed', 'data': {} }"
255 #endif /* QERROR_H */