Skip to content

Commit

Permalink
Improve exception message when DruidLeaderClient doesn't find leader …
Browse files Browse the repository at this point in the history
…node (apache#14775)

The existing exception message No known server thrown in DruidLeaderClient is unhelpful.
  • Loading branch information
findingrish authored Aug 10, 2023
1 parent c8537db commit 4b9846b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,11 @@ private String getCurrentKnownLeader(final boolean cached) throws IOException
);

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 {
return leader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ public void testNoLeaderFound() throws Exception
druidLeaderClient.start();

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");
}

Expand Down

0 comments on commit 4b9846b

Please sign in to comment.