Skip to content

Commit

Permalink
uploader: handle X-Clickhouse-Exception-Code header
Browse files Browse the repository at this point in the history
  • Loading branch information
teqwve committed Jan 30, 2024
1 parent 66e33f8 commit c5dfb9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions uploader/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ func (u *Base) insertRowBinary(table string, data io.Reader) error {

body, _ := ioutil.ReadAll(resp.Body)

if exceptionCode := resp.Header.Get("X-Clickhouse-Exception-Code"); exceptionCode != "" && exceptionCode != "0" {
return fmt.Errorf("clickhouse exception code %s, response status %d: %s", exceptionCode, resp.StatusCode, string(body))
}

if resp.StatusCode != 200 {
return fmt.Errorf("clickhouse response status %d: %s", resp.StatusCode, string(body))
}
Expand Down

0 comments on commit c5dfb9e

Please sign in to comment.