root / qerror.h @ a6906e31
History | View | Annotate | Download (2.4 kB)
1 | 9f9daf9a | Luiz Capitulino | /*
|
---|---|---|---|
2 | 9f9daf9a | Luiz Capitulino | * QError header file.
|
3 | 9f9daf9a | Luiz Capitulino | *
|
4 | 9f9daf9a | Luiz Capitulino | * Copyright (C) 2009 Red Hat Inc.
|
5 | 9f9daf9a | Luiz Capitulino | *
|
6 | 9f9daf9a | Luiz Capitulino | * Authors:
|
7 | 9f9daf9a | Luiz Capitulino | * Luiz Capitulino <lcapitulino@redhat.com>
|
8 | 9f9daf9a | Luiz Capitulino | *
|
9 | 9f9daf9a | Luiz Capitulino | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
10 | 9f9daf9a | Luiz Capitulino | * See the COPYING.LIB file in the top-level directory.
|
11 | 9f9daf9a | Luiz Capitulino | */
|
12 | 9f9daf9a | Luiz Capitulino | #ifndef QERROR_H
|
13 | 9f9daf9a | Luiz Capitulino | #define QERROR_H
|
14 | 9f9daf9a | Luiz Capitulino | |
15 | 9f9daf9a | Luiz Capitulino | #include "qdict.h" |
16 | 9f9daf9a | Luiz Capitulino | #include <stdarg.h> |
17 | 9f9daf9a | Luiz Capitulino | |
18 | 9f9daf9a | Luiz Capitulino | typedef struct QErrorStringTable { |
19 | 9f9daf9a | Luiz Capitulino | const char *desc; |
20 | 9f9daf9a | Luiz Capitulino | const char *error_fmt; |
21 | 9f9daf9a | Luiz Capitulino | } QErrorStringTable; |
22 | 9f9daf9a | Luiz Capitulino | |
23 | 9f9daf9a | Luiz Capitulino | typedef struct QError { |
24 | 9f9daf9a | Luiz Capitulino | QObject_HEAD; |
25 | 9f9daf9a | Luiz Capitulino | QDict *error; |
26 | 9f9daf9a | Luiz Capitulino | int linenr;
|
27 | 9f9daf9a | Luiz Capitulino | const char *file; |
28 | 9f9daf9a | Luiz Capitulino | const char *func; |
29 | 9f9daf9a | Luiz Capitulino | const QErrorStringTable *entry;
|
30 | 9f9daf9a | Luiz Capitulino | } QError; |
31 | 9f9daf9a | Luiz Capitulino | |
32 | 9f9daf9a | Luiz Capitulino | QError *qerror_new(void);
|
33 | 9f9daf9a | Luiz Capitulino | QError *qerror_from_info(const char *file, int linenr, const char *func, |
34 | 9f9daf9a | Luiz Capitulino | const char *fmt, va_list *va); |
35 | 9f9daf9a | Luiz Capitulino | void qerror_print(const QError *qerror); |
36 | 9f9daf9a | Luiz Capitulino | QError *qobject_to_qerror(const QObject *obj);
|
37 | 9f9daf9a | Luiz Capitulino | |
38 | 9f9daf9a | Luiz Capitulino | /*
|
39 | 9f9daf9a | Luiz Capitulino | * QError class list
|
40 | 9f9daf9a | Luiz Capitulino | */
|
41 | 4b9d4683 | Luiz Capitulino | #define QERR_COMMAND_NOT_FOUND \
|
42 | e16a1812 | Markus Armbruster | "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
|
43 | 4b9d4683 | Luiz Capitulino | |
44 | 0df37c41 | Luiz Capitulino | #define QERR_DEVICE_ENCRYPTED \
|
45 | e16a1812 | Markus Armbruster | "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
|
46 | 9f9daf9a | Luiz Capitulino | |
47 | b0868380 | Markus Armbruster | #define QERR_DEVICE_LOCKED \
|
48 | b0868380 | Markus Armbruster | "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
|
49 | b0868380 | Markus Armbruster | |
50 | 055f6122 | Luiz Capitulino | #define QERR_DEVICE_NOT_ACTIVE \
|
51 | e16a1812 | Markus Armbruster | "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
|
52 | e16a1812 | Markus Armbruster | |
53 | e16a1812 | Markus Armbruster | #define QERR_DEVICE_NOT_FOUND \
|
54 | e16a1812 | Markus Armbruster | "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
|
55 | 055f6122 | Luiz Capitulino | |
56 | 5cfe0264 | Markus Armbruster | #define QERR_DEVICE_NOT_REMOVABLE \
|
57 | 5cfe0264 | Markus Armbruster | "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
|
58 | 5cfe0264 | Markus Armbruster | |
59 | 17901e75 | Markus Armbruster | #define QERR_INVALID_BLOCK_FORMAT \
|
60 | 17901e75 | Markus Armbruster | "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
|
61 | 17901e75 | Markus Armbruster | |
62 | 4b9d4683 | Luiz Capitulino | #define QERR_INVALID_PARAMETER_TYPE \
|
63 | e16a1812 | Markus Armbruster | "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
|
64 | 4b9d4683 | Luiz Capitulino | |
65 | f6d855c5 | Luiz Capitulino | #define QERR_INVALID_PASSWORD \
|
66 | e16a1812 | Markus Armbruster | "{ 'class': 'InvalidPassword', 'data': {} }"
|
67 | e16a1812 | Markus Armbruster | |
68 | e16a1812 | Markus Armbruster | #define QERR_JSON_PARSING \
|
69 | e16a1812 | Markus Armbruster | "{ 'class': 'JSONParsing', 'data': {} }"
|
70 | f6d855c5 | Luiz Capitulino | |
71 | 82a60711 | Luiz Capitulino | #define QERR_KVM_MISSING_CAP \
|
72 | e16a1812 | Markus Armbruster | "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
|
73 | 82a60711 | Luiz Capitulino | |
74 | 4b9d4683 | Luiz Capitulino | #define QERR_MISSING_PARAMETER \
|
75 | e16a1812 | Markus Armbruster | "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
|
76 | 4b9d4683 | Luiz Capitulino | |
77 | 4b9d4683 | Luiz Capitulino | #define QERR_QMP_BAD_INPUT_OBJECT \
|
78 | e16a1812 | Markus Armbruster | "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
|
79 | 4b9d4683 | Luiz Capitulino | |
80 | 7a84cb23 | Markus Armbruster | #define QERR_SET_PASSWD_FAILED \
|
81 | 7a84cb23 | Markus Armbruster | "{ 'class': 'SetPasswdFailed', 'data': {} }"
|
82 | 7a84cb23 | Markus Armbruster | |
83 | 4b9d4683 | Luiz Capitulino | #define QERR_UNDEFINED_ERROR \
|
84 | e16a1812 | Markus Armbruster | "{ 'class': 'UndefinedError', 'data': {} }"
|
85 | 4b9d4683 | Luiz Capitulino | |
86 | a6906e31 | Markus Armbruster | #define QERR_VNC_SERVER_FAILED \
|
87 | a6906e31 | Markus Armbruster | "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
|
88 | a6906e31 | Markus Armbruster | |
89 | 9f9daf9a | Luiz Capitulino | #endif /* QERROR_H */ |