]>
Commit | Line | Data |
---|---|---|
9f9daf9a LC |
1 | /* |
2 | * QError header file. | |
3 | * | |
4 | * Copyright (C) 2009 Red Hat Inc. | |
5 | * | |
6 | * Authors: | |
7 | * Luiz Capitulino <lcapitulino@redhat.com> | |
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" |
9f9daf9a LC |
18 | #include <stdarg.h> |
19 | ||
20 | typedef struct QErrorStringTable { | |
21 | const char *desc; | |
22 | const char *error_fmt; | |
23 | } QErrorStringTable; | |
24 | ||
25 | typedef struct QError { | |
26 | QObject_HEAD; | |
27 | QDict *error; | |
827b0813 | 28 | Location loc; |
9f9daf9a LC |
29 | int linenr; |
30 | const char *file; | |
31 | const char *func; | |
32 | const QErrorStringTable *entry; | |
33 | } QError; | |
34 | ||
35 | QError *qerror_new(void); | |
36 | QError *qerror_from_info(const char *file, int linenr, const char *func, | |
37 | const char *fmt, va_list *va); | |
77e595e7 | 38 | QString *qerror_human(const QError *qerror); |
827b0813 | 39 | void qerror_print(QError *qerror); |
9f9daf9a LC |
40 | QError *qobject_to_qerror(const QObject *obj); |
41 | ||
42 | /* | |
43 | * QError class list | |
44 | */ | |
56e9f563 MA |
45 | #define QERR_BAD_BUS_FOR_DEVICE \ |
46 | "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }" | |
47 | ||
7bbd8237 MA |
48 | #define QERR_BUS_NOT_FOUND \ |
49 | "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }" | |
50 | ||
4b9d4683 | 51 | #define QERR_COMMAND_NOT_FOUND \ |
e16a1812 | 52 | "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }" |
4b9d4683 | 53 | |
0df37c41 | 54 | #define QERR_DEVICE_ENCRYPTED \ |
e16a1812 | 55 | "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }" |
9f9daf9a | 56 | |
fc5469d8 | 57 | #define QERR_DEVICE_LOCKED \ |
b0868380 MA |
58 | "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }" |
59 | ||
1ae78718 MA |
60 | #define QERR_DEVICE_MULTIPLE_BUSSES \ |
61 | "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }" | |
62 | ||
055f6122 | 63 | #define QERR_DEVICE_NOT_ACTIVE \ |
e16a1812 MA |
64 | "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }" |
65 | ||
66 | #define QERR_DEVICE_NOT_FOUND \ | |
67 | "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }" | |
055f6122 | 68 | |
5cfe0264 MA |
69 | #define QERR_DEVICE_NOT_REMOVABLE \ |
70 | "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }" | |
71 | ||
07574baf MA |
72 | #define QERR_DEVICE_NO_BUS \ |
73 | "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }" | |
74 | ||
c7c338c4 | 75 | #define QERR_FD_NOT_FOUND \ |
bd9d3064 | 76 | "{ 'class': 'FdNotFound', 'data': { 'name': %s } }" |
c7c338c4 | 77 | |
41471a23 | 78 | #define QERR_FD_NOT_SUPPLIED \ |
bd9d3064 | 79 | "{ 'class': 'FdNotSupplied', 'data': {} }" |
41471a23 | 80 | |
17901e75 MA |
81 | #define QERR_INVALID_BLOCK_FORMAT \ |
82 | "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }" | |
83 | ||
7a046f5f | 84 | #define QERR_INVALID_PARAMETER \ |
bd9d3064 | 85 | "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }" |
7a046f5f | 86 | |
4b9d4683 | 87 | #define QERR_INVALID_PARAMETER_TYPE \ |
e16a1812 | 88 | "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }" |
4b9d4683 | 89 | |
f6d855c5 | 90 | #define QERR_INVALID_PASSWORD \ |
e16a1812 MA |
91 | "{ 'class': 'InvalidPassword', 'data': {} }" |
92 | ||
93 | #define QERR_JSON_PARSING \ | |
94 | "{ 'class': 'JSONParsing', 'data': {} }" | |
f6d855c5 | 95 | |
82a60711 | 96 | #define QERR_KVM_MISSING_CAP \ |
e16a1812 | 97 | "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }" |
82a60711 | 98 | |
4b9d4683 | 99 | #define QERR_MISSING_PARAMETER \ |
e16a1812 | 100 | "{ 'class': 'MissingParameter', 'data': { 'name': %s } }" |
4b9d4683 | 101 | |
fc5469d8 MA |
102 | #define QERR_OPEN_FILE_FAILED \ |
103 | "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }" | |
104 | ||
c58a35f8 MA |
105 | #define QERR_PROPERTY_NOT_FOUND \ |
106 | "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }" | |
107 | ||
06b4a703 MA |
108 | #define QERR_PROPERTY_VALUE_BAD \ |
109 | "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }" | |
110 | ||
9c5eff95 MA |
111 | #define QERR_PROPERTY_VALUE_IN_USE \ |
112 | "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }" | |
113 | ||
84745d68 MA |
114 | #define QERR_PROPERTY_VALUE_NOT_FOUND \ |
115 | "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }" | |
116 | ||
4b9d4683 | 117 | #define QERR_QMP_BAD_INPUT_OBJECT \ |
e16a1812 | 118 | "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }" |
4b9d4683 | 119 | |
7a84cb23 MA |
120 | #define QERR_SET_PASSWD_FAILED \ |
121 | "{ 'class': 'SetPasswdFailed', 'data': {} }" | |
122 | ||
a488be27 | 123 | #define QERR_TOO_MANY_FILES \ |
bd9d3064 | 124 | "{ 'class': 'TooManyFiles', 'data': {} }" |
a488be27 | 125 | |
fc5469d8 MA |
126 | #define QERR_UNDEFINED_ERROR \ |
127 | "{ 'class': 'UndefinedError', 'data': {} }" | |
128 | ||
a6906e31 MA |
129 | #define QERR_VNC_SERVER_FAILED \ |
130 | "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }" | |
131 | ||
9f9daf9a | 132 | #endif /* QERROR_H */ |