The exceptions in the sqlanydb.py source file contain a bug where each class definition misapplies the "super" keyword.
class Error(Exception):
def __init__(self,err,sqlcode=0):
self._errortext = err
self._errorcode = sqlcode
@property
def errortext(self): return self._errortext
@property
def errorcode(self): return self._errorcode
...
class InterfaceError(Error):
"""Raise for interface, not database, related errors."""
def __init__(self, *args):
super(Error,self).__init__(*args)
In the above code, super(Error,self) will point to the parent class of Error in the MRO (e.g. Exception), not the parent class of Interface error as intended. This means that inspecting sqlanydb exceptions fails with an attribute error, e.g. AttributeError: 'DatabaseError' object has no attribute '_errortext'.
It would also be nice to add repr and str overloads, so error print outs are more informative (see below).
The exceptions in the sqlanydb.py source file contain a bug where each class definition misapplies the "super" keyword.
In the above code, super(Error,self) will point to the parent class of Error in the MRO (e.g. Exception), not the parent class of Interface error as intended. This means that inspecting sqlanydb exceptions fails with an attribute error, e.g.
AttributeError: 'DatabaseError' object has no attribute '_errortext'
.It would also be nice to add repr and str overloads, so error print outs are more informative (see below).
Reproducible test case below: