On Tue, Feb 20, 2018 at 01:05:23PM +0100, Andrea Bolognani wrote:
On Tue, 2018-02-20 at 11:25 +0000, Daniel P. Berrangé wrote:
> > Yesterday I argued in a different thread that it would be better
> > to include the enum name in the error message, since that's useful
> > information for developers whereas users 1) should never see this
> > kind of error to begin with and 2) when they do, their only course
> > of action is reporting the issue anyway.
>
> How about we standard it via a special API
>
> virReportErrorEnumRange(virDomainControllerModelUSB, val->type);
>
> and map this through to a VIR_ERR_ENUM_RANGE error code, with a fixed
> string format.
>
> "Value '%d' out of range for enum %s"
Sounds like a good idea! We could even add something like
This is a bug in libvirt, please report it.
or similar to make it clear that the user is not at fault.
I don't think we should go down that road - most errors are not the user's
fault - they the fault of some component somewhere in the stack.
Not sure about using a separate error code rather than the existing
INTERNAL_ERROR, though: it seems like it would not really buy us
anything.
--
Andrea Bolognani / Red Hat / Virtualization
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 :|