fix: check the X-ClickHouse-Exception-Code for err code
Summary
use the X-ClickHouse-Exception-Code header https://github.com/ClickHouse/ClickHouse/pull/8786
Related: #332 (similar issue can happen with inserts)
fixes: https://github.com/ClickHouse/clickhouse-js/issues/332
It does not fix it for select streaming, as the headers will already be received; this is only for inserts.
ok, so this solves a similar issue we had, should i open a separate issue for that?
ok, so this solves a similar issue we had, should i open a separate issue for that?
No, this is fine. Thanks for the contribution!
@dermasmid, is it possible to add an integration test for that? And one more question: in case of a CH error rejection, we usually return an instance of ClickHouseError. Is it the same when X-ClickHouse-Exception-Code is present in the response?
in theory the error should be parsed just fine, since it's using regex to find the error from the body: https://github.com/ClickHouse/clickhouse-js/blob/00af5c2cd90d7d37775158052e3e072be091c393/packages/client-common/src/error/parse_error.ts#L2
ill try to get a test in too