summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2013-10-23 13:31:23 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2013-10-23 15:38:39 (GMT)
commit080548538d4e2622c04f1a5f9370d8c1889c2959 (patch)
treeb7768ab0b5e2e8691b48c6a0d68ff7c11f56abbd /bindings
parente50981372fb788f4a8b1d4a2e72e7a51fec3ddd1 (diff)
downloadlasso-080548538d4e2622c04f1a5f9370d8c1889c2959.zip
lasso-080548538d4e2622c04f1a5f9370d8c1889c2959.tar.gz
lasso-080548538d4e2622c04f1a5f9370d8c1889c2959.tar.bz2
python: do not fail displaying a non-C error (fixes #3866)
The binding does a raise Error('failed to create object') but the local Error exception class expects a lasso error code, and will thus fail if printed. File ".../lasso.py", line 54, in __str__ return '<lasso.%s(%s): %s>' % (self.__class__.__name__, self.code, _lasso.strError(self.code)) TypeError: an integer is required
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/lang.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bindings/python/lang.py b/bindings/python/lang.py
index 4c3d7cc..72c2911 100644
--- a/bindings/python/lang.py
+++ b/bindings/python/lang.py
@@ -168,7 +168,10 @@ class Error(Exception):
raise exception
def __str__(self):
- return '<lasso.%s(%s): %s>' % (self.__class__.__name__, self.code, _lasso.strError(self.code))
+ if self.code:
+ return '<lasso.%s(%s): %s>' % (self.__class__.__name__, self.code, _lasso.strError(self.code))
+ else:
+ return '<lasso.%s: %s>' % (self.__class__.__name__, self.message)
def __getitem__(self, i):
# compatibility with SWIG bindings