aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-03-16 08:57:47 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-06-22 18:20:39 +0200
commit75158ebbe259f0bd8bf435e8f4827a43ec89c877 (patch)
treeeba61e08212343a1a688dae6f51897b0702ee8db /qmp.c
parentc6bf0f7ffa90c720377eb6bddd27037041acbc5b (diff)
qerror: Eliminate QERR_DEVICE_NOT_FOUND
Error classes other than ERROR_CLASS_GENERIC_ERROR should not be used in new code. Hiding them in QERR_ macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch: @@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E) Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/qmp.c b/qmp.c
index f2981de706..87d1d862ba 100644
--- a/qmp.c
+++ b/qmp.c
@@ -206,7 +206,8 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
if (ambiguous) {
error_setg(errp, "Path '%s' is ambiguous", path);
} else {
- error_set(errp, QERR_DEVICE_NOT_FOUND, path);
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", path);
}
return NULL;
}
@@ -236,7 +237,8 @@ int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret)
obj = object_resolve_path(path, NULL);
if (!obj) {
- error_set(&local_err, QERR_DEVICE_NOT_FOUND, path);
+ error_set(&local_err, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", path);
goto out;
}
@@ -261,7 +263,8 @@ int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret)
obj = object_resolve_path(path, NULL);
if (!obj) {
- error_set(&local_err, QERR_DEVICE_NOT_FOUND, path);
+ error_set(&local_err, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", path);
goto out;
}
@@ -518,7 +521,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
klass = object_class_by_name(typename);
if (klass == NULL) {
- error_set(errp, QERR_DEVICE_NOT_FOUND, typename);
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", typename);
return NULL;
}