diff options
author | Frédéric Péters <fpeters@entrouvert.com> | 2013-10-23 15:31:23 +0200 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2013-10-23 17:38:39 +0200 |
commit | 080548538d4e2622c04f1a5f9370d8c1889c2959 (patch) | |
tree | b7768ab0b5e2e8691b48c6a0d68ff7c11f56abbd /bindings | |
parent | e50981372fb788f4a8b1d4a2e72e7a51fec3ddd1 (diff) | |
download | lasso-080548538d4e2622c04f1a5f9370d8c1889c2959.tar.gz lasso-080548538d4e2622c04f1a5f9370d8c1889c2959.tar.xz lasso-080548538d4e2622c04f1a5f9370d8c1889c2959.zip |
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.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bindings/python/lang.py b/bindings/python/lang.py index 4c3d7cc5..72c2911c 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 |