Skip to content

Commit 557cddc

Browse files
authored
Merge pull request #182 from phil-schreiber/fix/http-response-code
convert error header into request error
2 parents 361dc01 + 65e7738 commit 557cddc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: conn.go

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"net/http"
1515
"net/url"
1616
"os"
17+
"strings"
1718
"sync/atomic"
1819
"time"
1920

@@ -293,6 +294,9 @@ func (c *conn) doRequest(ctx context.Context, req *http.Request) (io.ReadCloser,
293294
// response
294295
return nil, newError(string(msg))
295296
}
297+
if errHeader, ok := resp.Header[http.CanonicalHeaderKey("X-ClickHouse-Exception-Code")]; ok {
298+
return nil, newError(strings.Join(errHeader, ", "))
299+
}
296300

297301
return resp.Body, nil
298302
}

0 commit comments

Comments
 (0)