maytasm commented on a change in pull request #11711:
URL: https://github.com/apache/druid/pull/11711#discussion_r709914421
##########
File path:
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
##########
@@ -350,10 +369,18 @@ private void handleQueryParseException(
// Write to the response
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.setContentType(MediaType.APPLICATION_JSON);
- objectMapper.writeValue(
- response.getOutputStream(),
- ImmutableMap.of("error", errorMessage)
- );
+ if (serverConfig.isFilterResponse()
+ && serverConfig.getResponseWhitelistRegex().stream().noneMatch(pattern
-> pattern.matcher(errorMessage).matches())) {
+ objectMapper.writeValue(
+ response.getOutputStream(),
+ ImmutableMap.of("error", DEFAULT_QUERY_PARSE_EXCEPTION_MESSAGE)
Review comment:
The response format here is inconsistent with `QueryException`. I am not
sure why this was done this way. However, in this PR my intention is to keep
the response format the same as original. Notice, that this PR does not add any
new field in the response format, only remove fields that could already be
null, and change string message for existing fields.
However, both Exception thrown here and the Exception from further
downstream which uses `QueryException` already make the response inconsistent
for the same API call. Since, the format of `QueryException` is well
documented, I think we should change this to use `QueryException` too.
--
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]