root / qerror.h @ 543fc7b2
History | View | Annotate | Download (1.8 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 | 4b9d4683 | Luiz Capitulino | "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
|
43 | 4b9d4683 | Luiz Capitulino | |
44 | 357b6156 | Luiz Capitulino | #define QERR_DEVICE_NOT_FOUND \
|
45 | 357b6156 | Luiz Capitulino | "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
|
46 | 9f9daf9a | Luiz Capitulino | |
47 | 055f6122 | Luiz Capitulino | #define QERR_DEVICE_NOT_ACTIVE \
|
48 | 055f6122 | Luiz Capitulino | "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
|
49 | 055f6122 | Luiz Capitulino | |
50 | 4b9d4683 | Luiz Capitulino | #define QERR_INVALID_PARAMETER_TYPE \
|
51 | 4b9d4683 | Luiz Capitulino | "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
|
52 | 4b9d4683 | Luiz Capitulino | |
53 | 82a60711 | Luiz Capitulino | #define QERR_KVM_MISSING_CAP \
|
54 | 82a60711 | Luiz Capitulino | "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
|
55 | 82a60711 | Luiz Capitulino | |
56 | 4b9d4683 | Luiz Capitulino | #define QERR_MISSING_PARAMETER \
|
57 | 4b9d4683 | Luiz Capitulino | "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
|
58 | 4b9d4683 | Luiz Capitulino | |
59 | 4b9d4683 | Luiz Capitulino | #define QERR_QMP_BAD_INPUT_OBJECT \
|
60 | 4b9d4683 | Luiz Capitulino | "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
|
61 | 4b9d4683 | Luiz Capitulino | |
62 | 4b9d4683 | Luiz Capitulino | #define QERR_JSON_PARSING \
|
63 | 4b9d4683 | Luiz Capitulino | "{ 'class': 'JSONParsing', 'data': {} }"
|
64 | 4b9d4683 | Luiz Capitulino | |
65 | 4b9d4683 | Luiz Capitulino | #define QERR_UNDEFINED_ERROR \
|
66 | 4b9d4683 | Luiz Capitulino | "{ 'class': 'UndefinedError', 'data': {} }"
|
67 | 4b9d4683 | Luiz Capitulino | |
68 | 9f9daf9a | Luiz Capitulino | #endif /* QERROR_H */ |