Added TransportException and tests for it#2889
Conversation
|
Repository collaborators can run the JMH benchmark suite against this PR by commenting: Optional regression threshold override (Δ% on Time or Alloc/op; defaults to 10%): Only one benchmark run per PR is active at a time — issuing a new |
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
TriageCategory: Summary What this impacts
Concerns
Required reviewer action
|
There was a problem hiding this comment.
Pull request overview
Adds a new TransportException in client-v2 to better classify transport-layer failures (currently used for SSL-related issues) and extends integration tests to validate the new exception type.
Changes:
- Introduced
TransportExceptionas a dedicated exception type for transport-layer failures. - Updated HTTP client exception wrapping to throw
TransportExceptionforSSLException. - Added an integration test to assert
TransportExceptionis raised for SSL failures; added aClientExceptionctor that acceptsqueryId.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| client-v2/src/test/java/com/clickhouse/client/ErrorHandlingTests.java | Adds an integration test validating TransportException behavior for SSL failures. |
| client-v2/src/main/java/com/clickhouse/client/api/TransportException.java | New public exception type intended for transport-layer failures. |
| client-v2/src/main/java/com/clickhouse/client/api/internal/HttpAPIClientHelper.java | Wraps SSLException as TransportException instead of generic ClickHouseException. |
| client-v2/src/main/java/com/clickhouse/client/api/ClientException.java | Adds a constructor overload carrying queryId. |
| /** | ||
| * Any exception that happens inside transport logic and hard to categorize as client logic | ||
| * like connection initiation or data transfer. These exceptions are not retriable normally. | ||
| * Main purpose of this exception is to wrap transport specific. | ||
| */ |
| if (cause instanceof SSLException) { | ||
| return new ClickHouseException("SSL Problem", cause, queryId); | ||
| return new TransportException("SSL Problem", cause, queryId); | ||
| } |
| try (Client client = new Client.Builder() | ||
| .addEndpoint("https://localhost:" + secureServer.getPort()) | ||
| .setUsername("default") | ||
| .setPassword(ClickHouseServerForTest.getPassword()) | ||
| .compressClientRequest(true) | ||
| .build()) { | ||
|
|
||
| TransportException tex = Assert.expectThrows(TransportException.class, | ||
| () -> client.query("SELECT 1").get()); | ||
| Assert.assertTrue(tex.getMessage().contains("SSL Problem")); | ||
| } |



Summary
Checklist
Delete items not relevant to your PR: