Improve exception message when DruidLeaderClient doesn't find leader node (#14775)

The existing exception message No known server thrown in DruidLeaderClient is unhelpful.
This commit is contained in:
Rishabh Singh 2023-08-10 16:37:37 +05:30 committed by GitHub
parent c8537dbeaf
commit 4b9846b90f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -264,7 +264,11 @@ public class DruidLeaderClient
); );
if (leader == null) { if (leader == null) {
throw new IOE("No known server"); throw new IOE(
"A leader node could not be found for [%s] service. "
+ "Check logs of service [%s] to confirm it is healthy.",
nodeRoleToWatch, nodeRoleToWatch
);
} else { } else {
return leader; return leader;
} }

View File

@ -159,7 +159,9 @@ public class DruidLeaderClientTest extends BaseJettyTest
druidLeaderClient.start(); druidLeaderClient.start();
expectedException.expect(IOException.class); expectedException.expect(IOException.class);
expectedException.expectMessage("No known server"); expectedException.expectMessage(
"A leader node could not be found for [PEON] service. "
+ "Check logs of service [PEON] to confirm it is healthy.");
druidLeaderClient.makeRequest(HttpMethod.POST, "/simple/direct"); druidLeaderClient.makeRequest(HttpMethod.POST, "/simple/direct");
} }