4 * Copyright (C) 2009 Red Hat Inc.
7 * Luiz Capitulino <lcapitulino@redhat.com>
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.
17 #include "qemu-error.h"
20 typedef struct QErrorStringTable
{
22 const char *error_fmt
;
25 typedef struct QError
{
32 const QErrorStringTable
*entry
;
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
);
45 #define QERR_COMMAND_NOT_FOUND \
46 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
48 #define QERR_DEVICE_ENCRYPTED \
49 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
51 #define QERR_DEVICE_LOCKED \
52 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
54 #define QERR_DEVICE_NOT_ACTIVE \
55 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
57 #define QERR_DEVICE_NOT_FOUND \
58 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
60 #define QERR_DEVICE_NOT_REMOVABLE \
61 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
63 #define QERR_FD_NOT_FOUND \
64 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
66 #define QERR_FD_NOT_SUPPLIED \
67 "{ 'class': 'FdNotSupplied', 'data': {} }"
69 #define QERR_OPEN_FILE_FAILED \
70 "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
72 #define QERR_INVALID_BLOCK_FORMAT \
73 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
75 #define QERR_INVALID_PARAMETER \
76 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
78 #define QERR_INVALID_PARAMETER_TYPE \
79 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
81 #define QERR_INVALID_PASSWORD \
82 "{ 'class': 'InvalidPassword', 'data': {} }"
84 #define QERR_JSON_PARSING \
85 "{ 'class': 'JSONParsing', 'data': {} }"
87 #define QERR_KVM_MISSING_CAP \
88 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
90 #define QERR_MISSING_PARAMETER \
91 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
93 #define QERR_QMP_BAD_INPUT_OBJECT \
94 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
96 #define QERR_SET_PASSWD_FAILED \
97 "{ 'class': 'SetPasswdFailed', 'data': {} }"
99 #define QERR_UNDEFINED_ERROR \
100 "{ 'class': 'UndefinedError', 'data': {} }"
102 #define QERR_TOO_MANY_FILES \
103 "{ 'class': 'TooManyFiles', 'data': {} }"
105 #define QERR_VNC_SERVER_FAILED \
106 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
108 #endif /* QERROR_H */