gianm commented on code in PR #17653:
URL: https://github.com/apache/druid/pull/17653#discussion_r1950022970


##########
server/src/main/java/org/apache/druid/metadata/segment/CachedSegmentMetadataTransaction.java:
##########
@@ -74,14 +77,18 @@ class CachedSegmentMetadataTransaction implements 
SegmentMetadataTransaction
     if (leaderSelector.isLeader()) {
       this.startTerm = leaderSelector.localTerm();
     } else {
-      throw InternalServerError.exception("Not leader anymore. Cannot start 
transaction.");
+      throw DruidException.forPersona(DruidException.Persona.USER)
+                          
.ofCategory(DruidException.Category.SERVICE_UNAVAILABLE)
+                          .build("Not leader anymore. Cannot start 
transaction.");
     }
   }
 
   private void verifyStillLeaderWithSameTerm()
   {
     if (!isLeaderWithSameTerm()) {
-      throw InternalServerError.exception("Not leader anymore. Failing 
transaction.");
+      throw DruidException.forPersona(DruidException.Persona.USER)
+                          
.ofCategory(DruidException.Category.SERVICE_UNAVAILABLE)
+                          .build("Not leader anymore. Failing transaction.");

Review Comment:
   This message isn't great for a user-facing error. The error message should 
help the user figure out what to do next. Better would be like: "This API is 
not currently available. Please try your request again."



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to