]>
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" | |
16 | #include <stdarg.h> | |
17 | ||
18 | typedef struct QErrorStringTable { | |
19 | const char *desc; | |
20 | const char *error_fmt; | |
21 | } QErrorStringTable; | |
22 | ||
23 | typedef struct QError { | |
24 | QObject_HEAD; | |
25 | QDict *error; | |
26 | int linenr; | |
27 | const char *file; | |
28 | const char *func; | |
29 | const QErrorStringTable *entry; | |
30 | } QError; | |
31 | ||
32 | QError *qerror_new(void); | |
33 | QError *qerror_from_info(const char *file, int linenr, const char *func, | |
34 | const char *fmt, va_list *va); | |
35 | void qerror_print(const QError *qerror); | |
36 | QError *qobject_to_qerror(const QObject *obj); | |
37 | ||
38 | /* | |
39 | * QError class list | |
40 | */ | |
4b9d4683 | 41 | #define QERR_COMMAND_NOT_FOUND \ |
28acf422 | 42 | "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }" |
4b9d4683 | 43 | |
bcddbd0f | 44 | #define QERR_DEVICE_ENCRYPTED \ |
28acf422 | 45 | "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }" |
9f9daf9a | 46 | |
a46657d1 MA |
47 | #define QERR_DEVICE_LOCKED \ |
48 | "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }" | |
49 | ||
055f6122 | 50 | #define QERR_DEVICE_NOT_ACTIVE \ |
28acf422 MA |
51 | "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }" |
52 | ||
53 | #define QERR_DEVICE_NOT_FOUND \ | |
54 | "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }" | |
055f6122 | 55 | |
8cb1cec6 MA |
56 | #define QERR_DEVICE_NOT_REMOVABLE \ |
57 | "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }" | |
58 | ||
3e4cd634 MA |
59 | #define QERR_FD_NOT_FOUND \ |
60 | "{ 'class': 'fd_not_found', 'data': { 'name': %s } }" | |
61 | ||
e3646914 MA |
62 | #define QERR_FD_NOT_SUPPLIED \ |
63 | "{ 'class': 'fd_not_supplied', 'data': {} }" | |
64 | ||
c756b1e7 MA |
65 | #define QERR_INVALID_BLOCK_FORMAT \ |
66 | "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }" | |
67 | ||
0b52786c MA |
68 | #define QERR_INVALID_PARAMETER \ |
69 | "{ 'class': 'invalid_parameter', 'data': { 'name': %s } }" | |
70 | ||
4b9d4683 | 71 | #define QERR_INVALID_PARAMETER_TYPE \ |
28acf422 | 72 | "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }" |
4b9d4683 | 73 | |
6ccc51fd | 74 | #define QERR_INVALID_PASSWORD \ |
28acf422 MA |
75 | "{ 'class': 'InvalidPassword', 'data': {} }" |
76 | ||
77 | #define QERR_JSON_PARSING \ | |
78 | "{ 'class': 'JSONParsing', 'data': {} }" | |
6ccc51fd | 79 | |
82a60711 | 80 | #define QERR_KVM_MISSING_CAP \ |
28acf422 | 81 | "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }" |
82a60711 | 82 | |
4b9d4683 | 83 | #define QERR_MISSING_PARAMETER \ |
28acf422 | 84 | "{ 'class': 'MissingParameter', 'data': { 'name': %s } }" |
4b9d4683 LC |
85 | |
86 | #define QERR_QMP_BAD_INPUT_OBJECT \ | |
28acf422 | 87 | "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }" |
4b9d4683 | 88 | |
960a4b53 MA |
89 | #define QERR_SET_PASSWD_FAILED \ |
90 | "{ 'class': 'SetPasswdFailed', 'data': {} }" | |
91 | ||
4b9d4683 | 92 | #define QERR_UNDEFINED_ERROR \ |
28acf422 | 93 | "{ 'class': 'UndefinedError', 'data': {} }" |
4b9d4683 | 94 | |
ea2b7d70 MA |
95 | #define QERR_TOO_MANY_FILES \ |
96 | "{ 'class': 'fd_too_many_files', 'data': {} }" | |
97 | ||
fe7c6c90 MA |
98 | #define QERR_VNC_SERVER_FAILED \ |
99 | "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }" | |
100 | ||
9f9daf9a | 101 | #endif /* QERROR_H */ |