Patchwork [for-1.4,11/12] qmp: Use generic errors in memchar-read, memchar-write

login
register
mail settings
Submitter Markus Armbruster
Date Feb. 5, 2013, 4:22 p.m.
Message ID <1360081335-6594-12-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/218334/
State New
Headers show

Comments

Markus Armbruster - Feb. 5, 2013, 4:22 p.m.
From: Markus Armbruster <armbru@pond.sub.org>

New errors should be generic unless there's a real use case for rich
errors.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qapi-schema.json | 2 --
 qemu-char.c      | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
Eric Blake - Feb. 5, 2013, 10:35 p.m.
On 02/05/2013 09:22 AM, Markus Armbruster wrote:
> From: Markus Armbruster <armbru@pond.sub.org>
> 
> New errors should be generic unless there's a real use case for rich
> errors.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  qapi-schema.json | 2 --
>  qemu-char.c      | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index d8fa1c3..6f63791 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -352,7 +352,6 @@ 
 #          by default is 'utf8'.
 #
 # Returns: Nothing on success
-#          If @device is not a valid char device, DeviceNotFound
 #
 # Since: 1.4
 ##
@@ -374,7 +373,6 @@ 
 #          memchardev, by default is 'utf8'.
 #
 # Returns: data read from the device
-#          If @device is not a valid memchr device, DeviceNotFound
 #
 # Since: 1.4
 ##
diff --git a/qemu-char.c b/qemu-char.c
index d92578a..3123432 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2751,7 +2751,7 @@  void qmp_memchar_write(const char *device, const char *data,
 
     chr = qemu_chr_find(device);
     if (!chr) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_setg(errp, "Device '%s' not found", device);
         return;
     }
 
@@ -2790,7 +2790,7 @@  char *qmp_memchar_read(const char *device, int64_t size,
 
     chr = qemu_chr_find(device);
     if (!chr) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_setg(errp, "Device '%s' not found", device);
         return NULL;
     }