[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 12/54] spice-char: improve error reporting
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 12/54] spice-char: improve error reporting |
Date: |
Thu, 05 Jan 2017 14:03:54 +0000 |
Hi
On Wed, Jan 4, 2017 at 11:00 PM Eric Blake <address@hidden> wrote:
> On 12/12/2016 04:42 PM, Marc-André Lureau wrote:
> > Set errp to report errors up.
> >
> > Use error_report() to give hints about parameters on the right monitor,
> > instead of a direct fprintf() call.
> >
> > Signed-off-by: Marc-André Lureau <address@hidden>
> > ---
> > spice-qemu-char.c | 29 +++++++++--------------------
> > 1 file changed, 9 insertions(+), 20 deletions(-)
> >
>
> And it's shorter! I like it.
>
> > @@ -302,8 +286,13 @@ static Chardev *qemu_chr_open_spice_vmc(const
> CharDriver *driver,
> > }
> > }
> > if (*psubtype == NULL) {
> > - fprintf(stderr, "spice-qemu-char: unsupported type: %s\n",
> type);
> > - print_allowed_subtypes();
> > + char *subtypes = g_strjoinv(", ",
> > + (gchar **)spice_server_char_device_recognized_subtypes());
> > +
> > + error_setg(errp, "unsupported type name: %s", type);
> > + error_report("allowed spice char type names: %s", subtypes);
>
> However, I'm not sure if error_setg() followed by error_report() is
> correct; should you be using error_append_hint() instead? Markus?
>
>
That doesn't work well with command line errors. error_vprintf_unless_qmp()
doesn't print if !cur_mon. I sent a patch on the ML, and I'll follow your
suggestion.
--
Marc-André Lureau