root / qerror.h @ c05c7a73
History | View | Annotate | Download (4.2 kB)
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" |
16 |
#include "qstring.h" |
17 |
#include "qemu-error.h" |
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; |
28 |
Location loc; |
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); |
38 |
QString *qerror_human(const QError *qerror);
|
39 |
void qerror_print(QError *qerror);
|
40 |
QError *qobject_to_qerror(const QObject *obj);
|
41 |
|
42 |
/*
|
43 |
* QError class list
|
44 |
*/
|
45 |
#define QERR_BAD_BUS_FOR_DEVICE \
|
46 |
"{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
|
47 |
|
48 |
#define QERR_BUS_NOT_FOUND \
|
49 |
"{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
|
50 |
|
51 |
#define QERR_BUS_NO_HOTPLUG \
|
52 |
"{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
|
53 |
|
54 |
#define QERR_COMMAND_NOT_FOUND \
|
55 |
"{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
|
56 |
|
57 |
#define QERR_DEVICE_ENCRYPTED \
|
58 |
"{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
|
59 |
|
60 |
#define QERR_DEVICE_NOT_ENCRYPTED \
|
61 |
"{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
|
62 |
|
63 |
#define QERR_DEVICE_INIT_FAILED \
|
64 |
"{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
|
65 |
|
66 |
#define QERR_DEVICE_LOCKED \
|
67 |
"{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
|
68 |
|
69 |
#define QERR_DEVICE_MULTIPLE_BUSSES \
|
70 |
"{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
|
71 |
|
72 |
#define QERR_DEVICE_NOT_ACTIVE \
|
73 |
"{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
|
74 |
|
75 |
#define QERR_DEVICE_NOT_FOUND \
|
76 |
"{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
|
77 |
|
78 |
#define QERR_DEVICE_NOT_REMOVABLE \
|
79 |
"{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
|
80 |
|
81 |
#define QERR_DEVICE_NO_BUS \
|
82 |
"{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
|
83 |
|
84 |
#define QERR_FD_NOT_FOUND \
|
85 |
"{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
|
86 |
|
87 |
#define QERR_FD_NOT_SUPPLIED \
|
88 |
"{ 'class': 'FdNotSupplied', 'data': {} }"
|
89 |
|
90 |
#define QERR_INVALID_BLOCK_FORMAT \
|
91 |
"{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
|
92 |
|
93 |
#define QERR_INVALID_PARAMETER \
|
94 |
"{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
|
95 |
|
96 |
#define QERR_INVALID_PARAMETER_TYPE \
|
97 |
"{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
|
98 |
|
99 |
#define QERR_INVALID_PASSWORD \
|
100 |
"{ 'class': 'InvalidPassword', 'data': {} }"
|
101 |
|
102 |
#define QERR_JSON_PARSING \
|
103 |
"{ 'class': 'JSONParsing', 'data': {} }"
|
104 |
|
105 |
#define QERR_KVM_MISSING_CAP \
|
106 |
"{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
|
107 |
|
108 |
#define QERR_MISSING_PARAMETER \
|
109 |
"{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
|
110 |
|
111 |
#define QERR_NO_BUS_FOR_DEVICE \
|
112 |
"{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
|
113 |
|
114 |
#define QERR_OPEN_FILE_FAILED \
|
115 |
"{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
|
116 |
|
117 |
#define QERR_PROPERTY_NOT_FOUND \
|
118 |
"{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
|
119 |
|
120 |
#define QERR_PROPERTY_VALUE_BAD \
|
121 |
"{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
122 |
|
123 |
#define QERR_PROPERTY_VALUE_IN_USE \
|
124 |
"{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
125 |
|
126 |
#define QERR_PROPERTY_VALUE_NOT_FOUND \
|
127 |
"{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
128 |
|
129 |
#define QERR_QMP_BAD_INPUT_OBJECT \
|
130 |
"{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
|
131 |
|
132 |
#define QERR_SET_PASSWD_FAILED \
|
133 |
"{ 'class': 'SetPasswdFailed', 'data': {} }"
|
134 |
|
135 |
#define QERR_TOO_MANY_FILES \
|
136 |
"{ 'class': 'TooManyFiles', 'data': {} }"
|
137 |
|
138 |
#define QERR_UNDEFINED_ERROR \
|
139 |
"{ 'class': 'UndefinedError', 'data': {} }"
|
140 |
|
141 |
#define QERR_VNC_SERVER_FAILED \
|
142 |
"{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
|
143 |
|
144 |
#endif /* QERROR_H */ |