tursodatabase / libsql-client-py

Python SDK for libSQL

Home Page:https://libsql.org/libsql-client-py/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LibsqlError should explcitly contain an explanation of the error

CodingDoug opened this issue · 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.