libsql-client-py icon indicating copy to clipboard operation
libsql-client-py copied to clipboard

LibsqlError should explcitly contain an explanation of the error

Open CodingDoug opened this issue 2 years ago • 0 comments

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.

CodingDoug avatar Aug 02 '23 16:08 CodingDoug