diff --git a/conn.go b/conn.go index afe4437..bf132ab 100644 --- a/conn.go +++ b/conn.go @@ -14,6 +14,7 @@ import ( "net/http" "net/url" "os" + "strings" "sync/atomic" "time" @@ -293,6 +294,9 @@ func (c *conn) doRequest(ctx context.Context, req *http.Request) (io.ReadCloser, // response return nil, newError(string(msg)) } + if errHeader, ok := resp.Header[http.CanonicalHeaderKey("X-ClickHouse-Exception-Code")]; ok { + return nil, newError(strings.Join(errHeader, ", ")) + } return resp.Body, nil }