clickhouse-go
clickhouse-go copied to clipboard
Misleading error when making first connection using incorrect credentials to HTTP/S endpoint
The error
failed to read the response: read: read next block: data size should be 0 < 980316009 < 134217728
is returned when executing the first query to a database over HTTP/S if the crendentials are incorrect.
This error is encountered when conn_http.go
executeRequest
calls msg, err := h.readRawResponse(resp)
The status code should be returned in addition to any errors from readRawResponse.
We can introduce something like this:
type UnhandledHTTPResponseError {
Response *http.Response
}
func (e *UnhandledHTTPResponseError) Error() string {
return fmt.Sprintf("unhandled HTTP %d response received: %s, e.Response.StatusCode, ...)
}
and return it as an error value if the client wasn't able to read the response.
Agreed, sounds like a neat solution