[libvirt] PATCH: Improve python exception messages
Daniel Veillard
veillard at redhat.com
Tue Aug 19 13:38:07 UTC 2008
On Tue, Aug 19, 2008 at 10:31:34AM +0100, Daniel P. Berrange wrote:
> Most of the libvirt python API bindings use code snippet like this when
> raising an exception:
>
> if ret is None:raise libvirtError('virConnectOpen() failed')
>
>
> THis sets the message associated with the exception to
>
> "virConnectOpen() failed"
>
> This contains essentially zero useful information - you can see that it
> was virConnectOpen which failed from the stack trace.
>
> Now the libvirt error object has a real message, such as
>
> "authentication failed"
>
> Or
>
> "unable to connect to '/var/run/libvirt/libvirt-sock': Connection refused"
>
> This patch makes sure we extract this real error message and use it to
> set the message associated with the exception object. This is one step
> in getting better error reporting for virt-install/virt-manager, which
> is particularly needed for remote connections
Good idea, +1,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list