On Fri, Oct 30, 2020 at 2:22 AM Eduardo Habkost <ehabk...@redhat.com> wrote:

> Just setting a reasonable error string using error_setg() is
> simpler and makes error messages clearer.
>
> Before:
>
>   $ qemu-system-x86_64 -device vmgenid,guid=x
>   qemu-system-x86_64: -device vmgenid,guid=x: Property 'vmgenid.guid'
> doesn't take value 'x'
>
> After:
>
>   $ qemu-system-x86_64 -device vmgenid,guid=x
>   qemu-system-x86_64: -device vmgenid,guid=x: invalid UUID: 'x'
>
> Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
>

It looks like we agree that error_set_from_qdev_prop_error() should
eventually be replaced :)

Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com>

---
> Cc: Paolo Bonzini <pbonz...@redhat.com>
> Cc: "Daniel P. Berrangé" <berra...@redhat.com>
> Cc: Eduardo Habkost <ehabk...@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  hw/core/qdev-properties.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 59d65a7362..5b9907e8ba 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -509,7 +509,7 @@ static void set_uuid(Object *obj, Visitor *v, const
> char *name, void *opaque,
>      if (!strcmp(str, UUID_VALUE_AUTO)) {
>          qemu_uuid_generate(uuid);
>      } else if (qemu_uuid_parse(str, uuid) < 0) {
> -        error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
> +        error_setg(errp, "invalid UUID: '%s'", str);
>      }
>      g_free(str);
>  }
> --
> 2.28.0
>
>
>

-- 
Marc-André Lureau

Reply via email to