[libvirt] [PATCH 3/4] util: Add 'label' field to VIR_ENUM_IMPL

Daniel P. Berrangé berrange at redhat.com
Thu Apr 11 10:57:48 UTC 2019


On Mon, Apr 08, 2019 at 11:48:18AM -0400, Cole Robinson wrote:
> This allows us to raise error messages from virEnum*String functions.
> 
> FromString failure will report this error for value 'zzzz'
> 
>   invalid argument: Unknown 'domain type' value 'zzzz'
> 
> ToString failure will report this error for unknown type=83
> 
>   internal error: Unknown 'domain type' internal value '83'
> 
> However we disable the error reporting for now. It should only be
> enabled when we decide to begin dropping duplicate error reporting.

Why don't we *enable* error reporting now, but only if the label
string is non-NULL. Then just change your second patch to pass
NULL everywhere.  We can then incrementally replace the NULL with
a real message at the same time as we update each caller to drop
the existing error reporting.

This avoids any point in time having double reporting.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list