adarshsanjeev commented on code in PR #14687:
URL: https://github.com/apache/druid/pull/14687#discussion_r1278924541


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -873,17 +879,29 @@ private void checkForDurableStorageConnectorImpl()
     }
   }
 
-  private <T> T contactOverlord(final ListenableFuture<T> future)
+  private <T> T contactOverlord(final ListenableFuture<T> future, String 
queryId)
   {
     try {
       return FutureUtils.getUnchecked(future, true);
     }
     catch (RuntimeException e) {
+      if (e.getCause() instanceof HttpResponseException) {
+        HttpResponseException httpResponseException = (HttpResponseException) 
e.getCause();
+        if (httpResponseException.getResponse() != null && 
httpResponseException.getResponse().getResponse().getStatus()
+                                                                               
 .equals(HttpResponseStatus.NOT_FOUND)) {
+          // since we get a 404, we mark the request as a NotFound. This code 
path is generally triggered when user passes a `queryId` which is not found in 
the overlord.
+          throw queryNotFoundException(queryId);
+        }
+      }
       throw DruidException.forPersona(DruidException.Persona.DEVELOPER)
                           .ofCategory(DruidException.Category.UNCATEGORIZED)
                           .build("Unable to contact overlord " + 
e.getMessage());
     }
   }
 
+  private static DruidException queryNotFoundException(String queryId)
+  {
+    return NotFound.exception("Query[%s] not found", queryId);

Review Comment:
   How does this sound?
   ```suggestion
       return NotFound.exception("Query[%s] details not found. The query 
details are no longer present or might not be of type [%s]. Verify the id or 
rerun the query.", queryId, MSQControllerTask.TYPE);
   ```



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