Skip to content

Commit 2de860e

Browse files
authored
Merge pull request #1916 from ClickHouse/v2_fix_readin_404_error_msg
[client-v2] Fixed issue with 404 error message
2 parents b4c38d8 + f2e8854 commit 2de860e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

client-v2/src/main/java/com/clickhouse/client/api/internal/HttpAPIClientHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ private HttpEntity wrapEntity(HttpEntity httpEntity, int httpStatus, boolean isR
531531
case HttpStatus.SC_NOT_MODIFIED:
532532
case HttpStatus.SC_BAD_REQUEST:
533533
case HttpStatus.SC_INTERNAL_SERVER_ERROR:
534+
case HttpStatus.SC_NOT_FOUND:
534535
boolean useHttpCompression = MapUtils.getFlag(chConfiguration, "client.use_http_compression", false);
535536
return new LZ4Entity(httpEntity, useHttpCompression, serverCompression, clientCompression,
536537
MapUtils.getInt(chConfiguration, "compression.lz4.uncompressed_buffer_size"), isResponse);

client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,16 @@ public void testServerErrorHandling(ClickHouseFormat format, boolean serverCompr
341341
"Unexpected error message: " + e.getMessage());
342342
}
343343

344+
querySettings.serverSetting("unknown_setting", "1");
345+
try (QueryResponse response = client.query("CREATE TABLE table_from_csv AS SELECT * FROM file('empty.csv')", querySettings)
346+
.get(1, TimeUnit.SECONDS)) {
347+
Assert.fail("Expected exception");
348+
} catch (ServerException e) {
349+
e.printStackTrace();
350+
Assert.assertEquals(e.getCode(), 115);
351+
Assert.assertTrue(e.getMessage().startsWith("Code: 115. DB::Exception: Setting unknown_setting is neither a builtin setting nor started with the prefix 'custom_' registered for user-defined settings. (UNKNOWN_SETTING)"),
352+
"Unexpected error message: " + e.getMessage());
353+
}
344354

345355
} catch (Exception e) {
346356
e.printStackTrace();

0 commit comments

Comments
 (0)