[libvirt] [PATCH 1/4] Fix error messages codes when TypeFromString fails

Cole Robinson crobinso at redhat.com
Thu May 19 14:27:42 UTC 2011


On 05/18/2011 11:46 AM, Michal Privoznik wrote:
> ---
>  src/conf/cpu_conf.c                |    4 +-
>  src/conf/domain_conf.c             |  100 ++++++++++++++++++-----------------
>  src/conf/interface_conf.c          |    2 +-
>  src/conf/network_conf.c            |    2 +-
>  src/conf/node_device_conf.c        |    4 +-
>  src/conf/nwfilter_conf.c           |    6 +-
>  src/conf/secret_conf.c             |    2 +-
>  src/conf/storage_conf.c            |    2 +-
>  src/conf/storage_encryption_conf.c |    4 +-
>  9 files changed, 64 insertions(+), 62 deletions(-)
> 

Maybe we should make ToString raise the error for us? The VIR_ENUM_DECL
in domain_conf.h could pass in an error message like _("unknown CPU
match value"), and virEnumToString could do the failure checking for us,
append   " '%s'", type

Besides reducing code it would also make the error messages actually
consistent.

Thanks,
Cole




More information about the libvir-list mailing list