qerror.h 4.3 KB
Newer Older
L
Luiz Capitulino 已提交
1
/*
L
Luiz Capitulino 已提交
2
 * QError Module
L
Luiz Capitulino 已提交
3 4 5 6 7 8 9 10 11 12 13 14
 *
 * 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

15
#include "qapi/qmp/qstring.h"
16
#include "qemu/error-report.h"
17
#include "qapi/error.h"
18
#include "qapi-types.h"
L
Luiz Capitulino 已提交
19 20 21 22
#include <stdarg.h>

typedef struct QError {
    QObject_HEAD;
23
    Location loc;
24
    char *err_msg;
25
    ErrorClass err_class;
L
Luiz Capitulino 已提交
26 27
} QError;

28
QString *qerror_human(const QError *qerror);
29
void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
A
Anthony Liguori 已提交
30
void qerror_report_err(Error *err);
L
Luiz Capitulino 已提交
31 32 33

/*
 * QError class list
34
 * Please keep the definitions in alphabetical order.
35
 * Use scripts/check-qerror.sh to check.
L
Luiz Capitulino 已提交
36
 */
M
Marcelo Tosatti 已提交
37
#define QERR_BASE_NOT_FOUND \
38
    ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found"
M
Marcelo Tosatti 已提交
39

P
Paolo Bonzini 已提交
40 41 42
#define QERR_BLOCK_JOB_NOT_READY \
    ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed"

A
Anthony Liguori 已提交
43
#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
44
    ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by device '%s' does not support feature '%s'"
A
Anthony Liguori 已提交
45

46
#define QERR_BUS_NO_HOTPLUG \
47
    ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging"
48

49
#define QERR_BUS_NOT_FOUND \
50
    ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found"
L
Luiz Capitulino 已提交
51

52
#define QERR_DEVICE_HAS_NO_MEDIUM \
53
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
54

55
#define QERR_DEVICE_INIT_FAILED \
56
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized"
57

58
#define QERR_DEVICE_IN_USE \
59
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use"
60

61
#define QERR_DEVICE_IS_READ_ONLY \
62
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is read only"
63

64
#define QERR_DEVICE_NO_HOTPLUG \
65
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
66

67
#define QERR_DEVICE_NOT_FOUND \
68
    ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found"
69

M
Markus Armbruster 已提交
70
#define QERR_FD_NOT_FOUND \
71
    ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
M
Markus Armbruster 已提交
72

73
#define QERR_FD_NOT_SUPPLIED \
74
    ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS"
75

76
#define QERR_FEATURE_DISABLED \
77
    ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled"
78

79
#define QERR_INVALID_BLOCK_FORMAT \
80
    ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'"
81

M
Markus Armbruster 已提交
82
#define QERR_INVALID_PARAMETER \
83
    ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'"
M
Markus Armbruster 已提交
84

L
Luiz Capitulino 已提交
85
#define QERR_INVALID_PARAMETER_TYPE \
86
    ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s"
L
Luiz Capitulino 已提交
87

88
#define QERR_INVALID_PARAMETER_VALUE \
89
    ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s"
90

91
#define QERR_INVALID_PASSWORD \
92
    ERROR_CLASS_GENERIC_ERROR, "Password incorrect"
93

L
Luiz Capitulino 已提交
94
#define QERR_IO_ERROR \
95
    ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred"
L
Luiz Capitulino 已提交
96

97
#define QERR_JSON_PARSING \
98
    ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
M
Michael Roth 已提交
99

100
#define QERR_MIGRATION_ACTIVE \
101
    ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
102

L
Luiz Capitulino 已提交
103
#define QERR_MISSING_PARAMETER \
104
    ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
L
Luiz Capitulino 已提交
105

106
#define QERR_PERMISSION_DENIED \
107
    ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation"
108

109
#define QERR_PROPERTY_VALUE_BAD \
110
    ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'"
111

112
#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
113
    ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
114

115
#define QERR_QGA_COMMAND_FAILED \
116
    ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'"
117

L
Luiz Capitulino 已提交
118
#define QERR_QMP_BAD_INPUT_OBJECT \
119
    ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input"
L
Luiz Capitulino 已提交
120

121
#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
122
    ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'"
123

124
#define QERR_QMP_EXTRA_MEMBER \
125
    ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected"
126

127
#define QERR_SET_PASSWD_FAILED \
128
    ERROR_CLASS_GENERIC_ERROR, "Could not set password"
129

130
#define QERR_UNDEFINED_ERROR \
131
    ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred"
132

133
#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
134
    ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s"
135

136
#define QERR_UNSUPPORTED \
137
    ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
138

L
Luiz Capitulino 已提交
139
#endif /* QERROR_H */