[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error |
Date: |
Wed, 14 Oct 2009 11:51:07 -0300 |
On Wed, 14 Oct 2009 00:34:21 +0200
Markus Armbruster <address@hidden> wrote:
> Luiz Capitulino <address@hidden> writes:
>
> > Signed-off-by: Luiz Capitulino <address@hidden>
> > ---
> > hw/qdev.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/qdev.c b/hw/qdev.c
> > index 906e897..3ce48f7 100644
> > --- a/hw/qdev.c
> > +++ b/hw/qdev.c
> > @@ -28,6 +28,7 @@
> > #include "net.h"
> > #include "qdev.h"
> > #include "sysemu.h"
> > +#include "qerror.h"
> > #include "monitor.h"
> >
> > static int qdev_hotplug = 0;
> > @@ -176,8 +177,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
> > /* find driver */
> > info = qdev_find_info(NULL, driver);
> > if (!info) {
> > - qemu_error("Device \"%s\" not found. Try -device '?' for a
> > list.\n",
> > - driver);
> > + qemu_error_structed(QERR_QDEV_NFOUND, "{ s: s }", "name", driver);
> > return NULL;
> > }
> > if (info->no_user) {
>
> And here we pay the price for structured error objects: reporting an
> error becomes more difficult. The harder you make reporting errors, the
> fewer errors get caught and reported. Also, the result is harder to
> read.
>
> If we need the structure, then it's just a price we have to pay. Do we
> need it?
Yes, if we want clients to able to determine error causes.
Of course that we can decide to provide less information, but this
structure has three users (monitor protocol, command-line and monitor),
so adding information for one of them means adding for them all.
[Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Luiz Capitulino, 2009/10/13
- Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Markus Armbruster, 2009/10/13
- Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error,
Luiz Capitulino <=
- Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Daniel P. Berrange, 2009/10/19
- Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Gerd Hoffmann, 2009/10/19
- Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Daniel P. Berrange, 2009/10/19
- [Qemu-devel] Re: [PATCH 7/9] qdev: Use QError for not found error, Paolo Bonzini, 2009/10/19
Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Anthony Liguori, 2009/10/19
Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Daniel P. Berrange, 2009/10/19
Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Anthony Liguori, 2009/10/19
Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error, Daniel P. Berrange, 2009/10/19
[Qemu-devel] [PATCH 8/9] QError: Add do_info_balloon() errors, Luiz Capitulino, 2009/10/13
[Qemu-devel] [PATCH 9/9] monitor: do_info_balloon(): use QError, Luiz Capitulino, 2009/10/13