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

Re: [libvirt] [PATCH 4/8] Fix up the error message if we can't parse the snapshot XML.



On 04/23/2010 02:06 PM, Matthias Bolte wrote:
> 2010/4/23 Chris Lalancette <clalance redhat com>:
>> Signed-off-by: Chris Lalancette <clalance redhat com>
>> ---
>>  src/conf/domain_conf.c |    3 +--
>>  1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 6dc26c3..139712a 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -6614,8 +6614,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr,
>>     }
>>
>>     if (!xmlStrEqual(root->name, BAD_CAST "domainsnapshot")) {
>> -        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
>> -                              "%s", _("incorrect root element"));
>> +        virDomainReportError(VIR_ERR_XML_ERROR, "%s", _("domainsnapshot"));
>>         goto cleanup;
>>     }
>>
> 
> Could we have a bit more verbose error message here, like "unknown
> root element for domain snapshot"?

Well, we could go one of two ways.  The text that automatically
comes out from VIR_ERR_XML_ERROR is:

XML description for %s is not well formed or invalid

Where the %s would be replaced by "domainsnapshot" above.  So we could
either go with this patch, or we could do something more along the lines
of:

virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                     _("unknown root element for domain snapshot"));

I personally like this patch as it is, because it's clearly not an internal
error; it's an error in the data the user passed in.  But I don't really
care too much either way.

-- 
Chris Lalancette


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