]>
Commit | Line | Data |
---|---|---|
9f9daf9a | 1 | /* |
41836a9f | 2 | * QError Module |
9f9daf9a LC |
3 | * |
4 | * Copyright (C) 2009 Red Hat Inc. | |
5 | * | |
6 | * Authors: | |
7 | * Luiz Capitulino <lcapitulino@redhat.com> | |
8 | * | |
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. | |
11 | */ | |
12 | #ifndef QERROR_H | |
13 | #define QERROR_H | |
14 | ||
7b1b5d19 | 15 | #include "qapi/qmp/qstring.h" |
1de7afc9 | 16 | #include "qemu/error-report.h" |
7b1b5d19 | 17 | #include "qapi/error.h" |
13f59ae8 | 18 | #include "qapi-types.h" |
9f9daf9a LC |
19 | #include <stdarg.h> |
20 | ||
9f9daf9a LC |
21 | typedef struct QError { |
22 | QObject_HEAD; | |
827b0813 | 23 | Location loc; |
18da7c0f | 24 | char *err_msg; |
13f59ae8 | 25 | ErrorClass err_class; |
9f9daf9a LC |
26 | } QError; |
27 | ||
77e595e7 | 28 | QString *qerror_human(const QError *qerror); |
13f59ae8 | 29 | void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3); |
2a82d936 | 30 | void qerror_report_err(Error *err); |
9f9daf9a LC |
31 | |
32 | /* | |
33 | * QError class list | |
9d494c4b | 34 | * Please keep the definitions in alphabetical order. |
9737383b | 35 | * Use scripts/check-qerror.sh to check. |
9f9daf9a | 36 | */ |
019b8cbf | 37 | #define QERR_BASE_NOT_FOUND \ |
df1e608a | 38 | ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found" |
019b8cbf | 39 | |
5b7a580f AG |
40 | #define QERR_BLOCK_JOB_NOT_READY \ |
41 | ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed" | |
42 | ||
8eae73b5 | 43 | #define QERR_BUS_NO_HOTPLUG \ |
df1e608a | 44 | ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging" |
8eae73b5 | 45 | |
c1303596 | 46 | #define QERR_BUS_NOT_FOUND \ |
df1e608a | 47 | ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found" |
4b9d4683 | 48 | |
939a1cc3 | 49 | #define QERR_DEVICE_HAS_NO_MEDIUM \ |
df1e608a | 50 | ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium" |
939a1cc3 | 51 | |
4d9a1a15 | 52 | #define QERR_DEVICE_INIT_FAILED \ |
df1e608a | 53 | ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized" |
4d9a1a15 | 54 | |
5124eb59 | 55 | #define QERR_DEVICE_IN_USE \ |
df1e608a | 56 | ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use" |
5124eb59 | 57 | |
c1303596 | 58 | #define QERR_DEVICE_NO_HOTPLUG \ |
df1e608a | 59 | ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging" |
c1303596 | 60 | |
e16a1812 | 61 | #define QERR_DEVICE_NOT_FOUND \ |
df1e608a | 62 | ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found" |
055f6122 | 63 | |
c7c338c4 | 64 | #define QERR_FD_NOT_FOUND \ |
df1e608a | 65 | ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found" |
c7c338c4 | 66 | |
41471a23 | 67 | #define QERR_FD_NOT_SUPPLIED \ |
df1e608a | 68 | ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS" |
41471a23 | 69 | |
c1303596 | 70 | #define QERR_FEATURE_DISABLED \ |
df1e608a | 71 | ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled" |
c1303596 | 72 | |
17901e75 | 73 | #define QERR_INVALID_BLOCK_FORMAT \ |
df1e608a | 74 | ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'" |
17901e75 | 75 | |
7a046f5f | 76 | #define QERR_INVALID_PARAMETER \ |
df1e608a | 77 | ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'" |
7a046f5f | 78 | |
4b9d4683 | 79 | #define QERR_INVALID_PARAMETER_TYPE \ |
df1e608a | 80 | ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s" |
4b9d4683 | 81 | |
985a3e52 | 82 | #define QERR_INVALID_PARAMETER_VALUE \ |
df1e608a | 83 | ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s" |
985a3e52 | 84 | |
f6d855c5 | 85 | #define QERR_INVALID_PASSWORD \ |
df1e608a | 86 | ERROR_CLASS_GENERIC_ERROR, "Password incorrect" |
e16a1812 | 87 | |
58898873 | 88 | #define QERR_IO_ERROR \ |
df1e608a | 89 | ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred" |
58898873 | 90 | |
c1303596 | 91 | #define QERR_JSON_PARSING \ |
df1e608a | 92 | ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax" |
c40cc0a0 | 93 | |
a4acc064 | 94 | #define QERR_MIGRATION_ACTIVE \ |
df1e608a | 95 | ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress" |
a4acc064 | 96 | |
4b9d4683 | 97 | #define QERR_MISSING_PARAMETER \ |
df1e608a | 98 | ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing" |
4b9d4683 | 99 | |
44677ded | 100 | #define QERR_PERMISSION_DENIED \ |
df1e608a | 101 | ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation" |
44677ded | 102 | |
06b4a703 | 103 | #define QERR_PROPERTY_VALUE_BAD \ |
df1e608a | 104 | ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'" |
06b4a703 | 105 | |
6aced82c | 106 | #define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ |
df1e608a | 107 | ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" |
6aced82c | 108 | |
c1303596 | 109 | #define QERR_QGA_COMMAND_FAILED \ |
df1e608a | 110 | ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'" |
c1303596 | 111 | |
4b9d4683 | 112 | #define QERR_QMP_BAD_INPUT_OBJECT \ |
df1e608a | 113 | ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input" |
4b9d4683 | 114 | |
7dfb6123 | 115 | #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \ |
df1e608a | 116 | ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'" |
7dfb6123 | 117 | |
60d76d7b | 118 | #define QERR_QMP_EXTRA_MEMBER \ |
df1e608a | 119 | ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected" |
60d76d7b | 120 | |
7a84cb23 | 121 | #define QERR_SET_PASSWD_FAILED \ |
df1e608a | 122 | ERROR_CLASS_GENERIC_ERROR, "Could not set password" |
7a84cb23 | 123 | |
fc5469d8 | 124 | #define QERR_UNDEFINED_ERROR \ |
df1e608a | 125 | ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred" |
fc5469d8 | 126 | |
f54e3641 | 127 | #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \ |
df1e608a | 128 | ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s" |
f54e3641 | 129 | |
c1303596 | 130 | #define QERR_UNSUPPORTED \ |
df1e608a | 131 | ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported" |
c1303596 | 132 | |
9f9daf9a | 133 | #endif /* QERROR_H */ |