[libvirt] [PATCH] Unify most error reporting (ver 2)

Jim Meyering jim at meyering.net
Fri Oct 10 12:19:34 UTC 2008


"Daniel P. Berrange" <berrange at redhat.com> wrote:
...
> Some parts of qemu supply it, many other parts do not since they
> have no access to the virDomainPtr object. This is one of the
> reasons for deprecating this field - it was impossible to reliably
> provide it when raising errors.
>
> In this particular test case error, we are better off supplying the
> domain name in the format string - it'll improve the error message
> to have it placed in context of the description
>
> eg, instead of
>
>  libvir: Test error test: internal error Domain is still running
>
>
> We'd have
>
>  libvir: Test error: internal error Domain 'test' is still running
>
> Which could be done by changing
>
>     if (privdom->state != VIR_DOMAIN_SHUTOFF) {
>         testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
>                   _("Domain is still running"));
>
>
> to be
>
>     if (privdom->state != VIR_DOMAIN_SHUTOFF) {
>         testError(domain->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
>                   _("Domain '%s' is still running"), domain->name);

Yep.  I began doing that about 15 minutes ago ;-)




More information about the libvir-list mailing list