tursodatabase / libsql-client-go

Go client API for libSQL
MIT License
159 stars 23 forks source link

Fix server error handling #81

Closed penberg closed 8 months ago

penberg commented 8 months ago

If the server returns 401, for example, it is not in the same format as Hrana errors. Therefore, first attempt to parse a server error and only then parse Hrana errors.

For example, the following error:

Error: failed to connect to database. err: failed to execute SQL: SELECT 1;

now becomes:

Error: failed to connect to database. err: failed to execute SQL: SELECT 1; error code 401: Unauthorized: TheAuthorizationHTTP header is required but was not specified