libsql-client-py
libsql-client-py copied to clipboard
LibsqlError should explcitly contain an explanation of the error
class LibsqlError(RuntimeError):
code: str
def __init__(self, message: str, code: str):
super(RuntimeError, self).__init__(f"{code}: {message}")
self.code = code
We have a code, which is normally the SQLite error code, such as SQLITE_CONSTRAINT, but the message of the error doesn't have representation here. The developer must dig into args to make some assumptions about what's there. It would be better if message was also a field here with the English explanation of the error.