summaryrefslogtreecommitdiffstats
path: root/generator.py
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2006-11-07 23:18:56 +0000
committerDaniel P. Berrange <berrange@redhat.com>2006-11-07 23:18:56 +0000
commit945919ffff7f4e856d17d2b5a6b48cab5417d92f (patch)
tree3305085c6fb2534b0e4bc607eb1c6f30eb67e8fd /generator.py
parent54db0825da704d121264647798fdd829a3ade6e2 (diff)
downloadlibvirt-python-split-945919ffff7f4e856d17d2b5a6b48cab5417d92f.tar.gz
libvirt-python-split-945919ffff7f4e856d17d2b5a6b48cab5417d92f.tar.xz
libvirt-python-split-945919ffff7f4e856d17d2b5a6b48cab5417d92f.zip
Propagate libvirt errors back with python exceptions
Diffstat (limited to 'generator.py')
-rwxr-xr-xgenerator.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/generator.py b/generator.py
index e973db1..5aa2625 100755
--- a/generator.py
+++ b/generator.py
@@ -260,6 +260,8 @@ foreign_encoding_args = (
# code is still automatically generated (so they are not in skip_function()).
skip_impl = (
'virConnectListDomainsID',
+ 'virConnGetLastError',
+ 'virGetLastError',
'virDomainGetInfo',
'virNodeGetInfo',
'virDomainGetUUID',
@@ -869,9 +871,18 @@ def buildWrappers():
classes.write(
" if ret is None:return None\n");
else:
- classes.write(
+ if classname == "virConnect":
+ classes.write(
+ " if ret is None:raise libvirtError('%s() failed', conn=self)\n" %
+ (name))
+ elif classname == "virDomain":
+ classes.write(
+ " if ret is None:raise libvirtError('%s() failed')\n" %
+ (name))
+ else:
+ classes.write(
" if ret is None:raise libvirtError('%s() failed')\n" %
- (name))
+ (name))
#
# generate the returned class wrapper for the object