qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/54] spice-char: improve error reporting


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 12/54] spice-char: improve error reporting
Date: Wed, 4 Jan 2017 16:00:03 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

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?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]