tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
289 stars 37 forks source link

Remote databases don't support raw error code #117

Open penberg opened 1 year ago

penberg commented 1 year ago

I disabled the raw error code tests in 846b2d0fc2f80fc9cb87bb1db4158857e8c7f54f for remote databases because we never set the error code for remote database errors:

export function mapHranaError(e: unknown): unknown {
    if (e instanceof hrana.ClientError) {
        const code = mapHranaErrorCode(e);
        return new LibsqlError(e.message, code, undefined, e);
    }
    return e;
}

(It's the undefined there after code when constructing LibsqlError)