Skip to content

Commit

Permalink
fix: check the X-ClickHouse-Exception-Code for err code, fixes: Click…
Browse files Browse the repository at this point in the history
  • Loading branch information
dermasmid committed Nov 5, 2024
1 parent 00af5c2 commit 26062af
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/client-common/src/utils/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ export function withHttpSettings(
}
}

export function isSuccessfulResponse(statusCode?: number): boolean {
return Boolean(statusCode && 200 <= statusCode && statusCode < 300)
export function isSuccessfulResponse(
statusCode?: number,
headers: Record<string, string> = {},
): boolean {
return Boolean(
statusCode &&
200 <= statusCode &&
statusCode < 300 &&
!headers['X-ClickHouse-Exception-Code'],
)
}

0 comments on commit 26062af

Please sign in to comment.