LakshSingla commented on code in PR #14687:
URL: https://github.com/apache/druid/pull/14687#discussion_r1277540579
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -879,6 +881,16 @@ private <T> T contactOverlord(final ListenableFuture<T>
future)
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 an invalid input. This
code path is generally triggered when user passes a `queryId` which is not
found on the overlord.
+ throw DruidException.forPersona(DruidException.Persona.DEVELOPER)
Review Comment:
Why is this a DEVELOPER error of type INVALID_INPUT?
1. What's the invalid input in this case? This method seems to just call the
getUnchecked method, therefore it can be called from multiple places. It would
be better if we can rename the method to something more appropriate and also
extrapolate the input value, the query id, in the error message which is invalid
2. Seems like this is a public API and is called by the users or apps like
web-console. In that case this isn't an error aimed towards the developer. It
should be USER. DEVELOPER errors, unless there's a good reason, are always
DEFENSIVE (check javadocs for DruidException.Persona#DEVELOPER).
3. We can reuse the `InvalidInput` class instead of creating the whole
thing. The benefit would be that the `errorCode` in that case would be
`invalidInput` and not `general` in the current case.
--
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]