planetscale-go
planetscale-go copied to clipboard
401 Unauthorized returns nondescript error
If the API returns a 401, like if a bad token is passed into the client constructor, all errors will appear as internal error, response body doesn't match error type signature.
This is caused by the error message being non-standard from the API in: https://github.com/planetscale/planetscale-go/blob/3f6f5f81427fd4ec15accadf58508711c569fda7/planetscale/client.go#L196-L211
The response from the API is:
{"error":"invalid_token","error_description":"The access token is invalid","state":"unauthorized"}
The TODO is almost a year old. Is it worth adding a 2nd (deprecated) ErrorResponse type to handle this other structure?