
On 11/25/2011 05:50 AM, Michal Privoznik wrote:
When user pass wrong root element, it is not 'internal error' and we can give him hint what we are expecting. --- src/conf/domain_conf.c | 12 ++++++++---- src/conf/interface_conf.c | 6 ++++-- src/conf/network_conf.c | 6 ++++-- src/conf/node_device_conf.c | 6 ++++-- src/conf/secret_conf.c | 6 ++++-- src/security/virt-aa-helper.c | 2 +- 6 files changed, 25 insertions(+), 13 deletions(-)
Overall, a nice improvement.
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f04e477..bb504f9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7932,8 +7932,10 @@ virDomainDefPtr virDomainDefParseNode(virCapsPtr caps, virDomainDefPtr def = NULL;
if (!xmlStrEqual(root->name, BAD_CAST "domain")) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("incorrect root element")); + virDomainReportError(VIR_ERR_XML_ERROR, + _("unexpected root element <%s>, " + "expecting <domain>"), + root->name); goto cleanup; }
But while most hunks list the user's incorrect element,
+++ b/src/security/virt-aa-helper.c @@ -644,7 +644,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr) }
if (!xmlStrEqual(ctxt->node->name, BAD_CAST "domain")) { - vah_error(NULL, 0, _("incorrect root element")); + vah_error(NULL, 0, _("unexpected root element, expecting <domain>"));
this one does not. ACK with virt-aa-helper fixed to be like the others. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org