[Libvir] Proposal: Python bindings should turn NO_DOMAIN/NO_NETWORK errors in KeyError exceptions

Richard W.M. Jones rjones at redhat.com
Wed Jul 4 11:22:17 UTC 2007


Daniel Veillard wrote:
> On Wed, Jul 04, 2007 at 10:44:29AM +0100, Richard W.M. Jones wrote:
>> I propose that we should change the Python bindings so that when the 
>> virterror errors VIR_ERR_NO_DOMAIN and VIR_ERR_NO_NETWORK occur in the 
>> lookup* functions only, should cause KeyError to be raised.
>>
>> According to:
>>
>> http://docs.python.org/lib/module-exceptions.html
>>
>> "[KeyError is] raised when a mapping (dictionary) key is not found in 
>> the set of existing keys."
>>
>> I've already changed the OCaml bindings so that these errors get 
>> converted into Not_found exception, which is the "natural" exception for 
>> when something is looked up and not found.
> 
>   I think this makes sense, I just wonder a bit about the impact on 
> existing client code,

Yes, I have asked Hugh to comment, but it's Independence Day over there 
so don't expect anything before tomorrow.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070704/70c591e5/attachment-0001.bin>


More information about the libvir-list mailing list