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
This commit is contained in:
parent
e50981372f
commit
080548538d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue