2009-11-19 02:05:30 +01:00
|
|
|
/*
|
|
|
|
* QError header file.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
|
|
|
* See the COPYING.LIB file in the top-level directory.
|
|
|
|
*/
|
|
|
|
#ifndef QERROR_H
|
|
|
|
#define QERROR_H
|
|
|
|
|
|
|
|
#include "qdict.h"
|
2009-12-07 21:37:16 +01:00
|
|
|
#include "qstring.h"
|
2009-11-19 02:05:30 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
typedef struct QErrorStringTable {
|
|
|
|
const char *desc;
|
|
|
|
const char *error_fmt;
|
|
|
|
} QErrorStringTable;
|
|
|
|
|
|
|
|
typedef struct QError {
|
|
|
|
QObject_HEAD;
|
|
|
|
QDict *error;
|
|
|
|
int linenr;
|
|
|
|
const char *file;
|
|
|
|
const char *func;
|
|
|
|
const QErrorStringTable *entry;
|
|
|
|
} QError;
|
|
|
|
|
|
|
|
QError *qerror_new(void);
|
|
|
|
QError *qerror_from_info(const char *file, int linenr, const char *func,
|
|
|
|
const char *fmt, va_list *va);
|
2009-12-07 21:37:16 +01:00
|
|
|
QString *qerror_human(const QError *qerror);
|
2009-11-19 02:05:30 +01:00
|
|
|
void qerror_print(const QError *qerror);
|
|
|
|
QError *qobject_to_qerror(const QObject *obj);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* QError class list
|
|
|
|
*/
|
2009-11-27 01:58:57 +01:00
|
|
|
#define QERR_COMMAND_NOT_FOUND \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
|
2009-11-27 01:58:57 +01:00
|
|
|
|
2009-12-07 21:36:59 +01:00
|
|
|
#define QERR_DEVICE_ENCRYPTED \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
|
2009-11-19 02:05:30 +01:00
|
|
|
|
2009-12-07 21:37:03 +01:00
|
|
|
#define QERR_DEVICE_LOCKED \
|
|
|
|
"{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
|
|
|
|
|
2009-11-19 02:05:34 +01:00
|
|
|
#define QERR_DEVICE_NOT_ACTIVE \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
|
|
|
|
|
|
|
|
#define QERR_DEVICE_NOT_FOUND \
|
|
|
|
"{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
|
2009-11-19 02:05:34 +01:00
|
|
|
|
2009-12-07 21:37:04 +01:00
|
|
|
#define QERR_DEVICE_NOT_REMOVABLE \
|
|
|
|
"{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
|
|
|
|
|
2009-12-07 21:37:10 +01:00
|
|
|
#define QERR_FD_NOT_FOUND \
|
2009-12-08 13:33:54 +01:00
|
|
|
"{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
|
2009-12-07 21:37:10 +01:00
|
|
|
|
2009-12-07 21:37:12 +01:00
|
|
|
#define QERR_FD_NOT_SUPPLIED \
|
2009-12-08 13:33:54 +01:00
|
|
|
"{ 'class': 'FdNotSupplied', 'data': {} }"
|
2009-12-07 21:37:12 +01:00
|
|
|
|
2010-01-20 13:07:31 +01:00
|
|
|
#define QERR_OPEN_FILE_FAILED \
|
|
|
|
"{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
|
|
|
|
|
2009-12-07 21:37:06 +01:00
|
|
|
#define QERR_INVALID_BLOCK_FORMAT \
|
|
|
|
"{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
|
|
|
|
|
2010-01-20 13:07:34 +01:00
|
|
|
#define QERR_INVALID_CPU_INDEX \
|
|
|
|
"{ 'class': 'InvalidCPUIndex', 'data': {} }"
|
|
|
|
|
2009-12-07 21:37:13 +01:00
|
|
|
#define QERR_INVALID_PARAMETER \
|
2009-12-08 13:33:54 +01:00
|
|
|
"{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
|
2009-12-07 21:37:13 +01:00
|
|
|
|
2009-11-27 01:58:57 +01:00
|
|
|
#define QERR_INVALID_PARAMETER_TYPE \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
|
2009-11-27 01:58:57 +01:00
|
|
|
|
2009-12-04 18:24:08 +01:00
|
|
|
#define QERR_INVALID_PASSWORD \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'InvalidPassword', 'data': {} }"
|
|
|
|
|
|
|
|
#define QERR_JSON_PARSING \
|
|
|
|
"{ 'class': 'JSONParsing', 'data': {} }"
|
2009-12-04 18:24:08 +01:00
|
|
|
|
2009-11-19 02:05:35 +01:00
|
|
|
#define QERR_KVM_MISSING_CAP \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
|
2009-11-19 02:05:35 +01:00
|
|
|
|
2009-11-27 01:58:57 +01:00
|
|
|
#define QERR_MISSING_PARAMETER \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
|
2009-11-27 01:58:57 +01:00
|
|
|
|
|
|
|
#define QERR_QMP_BAD_INPUT_OBJECT \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
|
2009-11-27 01:58:57 +01:00
|
|
|
|
2009-12-07 21:37:07 +01:00
|
|
|
#define QERR_SET_PASSWD_FAILED \
|
|
|
|
"{ 'class': 'SetPasswdFailed', 'data': {} }"
|
|
|
|
|
2009-11-27 01:58:57 +01:00
|
|
|
#define QERR_UNDEFINED_ERROR \
|
2009-12-07 21:37:02 +01:00
|
|
|
"{ 'class': 'UndefinedError', 'data': {} }"
|
2009-11-27 01:58:57 +01:00
|
|
|
|
2009-12-07 21:37:14 +01:00
|
|
|
#define QERR_TOO_MANY_FILES \
|
2009-12-08 13:33:54 +01:00
|
|
|
"{ 'class': 'TooManyFiles', 'data': {} }"
|
2009-12-07 21:37:14 +01:00
|
|
|
|
2009-12-07 21:37:08 +01:00
|
|
|
#define QERR_VNC_SERVER_FAILED \
|
|
|
|
"{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
|
|
|
|
|
2009-11-19 02:05:30 +01:00
|
|
|
#endif /* QERROR_H */
|