abhishekrb19 commented on code in PR #15673:
URL: https://github.com/apache/druid/pull/15673#discussion_r1449930870


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java:
##########
@@ -939,10 +939,19 @@ public Response killPendingSegments(
     }
 
     if (taskMaster.isLeader()) {
-      final int numDeleted = 
indexerMetadataStorageAdapter.deletePendingSegments(dataSource, deleteInterval);
-      return Response.ok().entity(ImmutableMap.of("numDeleted", 
numDeleted)).build();
+      try {
+        final int numDeleted = 
indexerMetadataStorageAdapter.deletePendingSegments(dataSource, deleteInterval);
+        return Response.ok().entity(ImmutableMap.of("numDeleted", 
numDeleted)).build();
+      }
+      catch (DruidException e) {
+        return Response.status(Response.Status.BAD_REQUEST)

Review Comment:
   Extracted the code from `e.getStatusCode()`, which uses the underlying 
exception category's status code. Also, added a generic catch block to handle 
non-DruidException and updated the tests



-- 
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