cryptoe commented on code in PR #16821:
URL: https://github.com/apache/druid/pull/16821#discussion_r1753807972
##########
server/src/main/java/org/apache/druid/server/initialization/jetty/CustomExceptionMapper.java:
##########
@@ -30,13 +31,20 @@
@Provider
public class CustomExceptionMapper implements
ExceptionMapper<JsonMappingException>
{
+ private static final Logger log = new Logger(CustomExceptionMapper.class);
+ public static final String ERROR_KEY = "error";
+ public static final String UNABLE_TO_PROCESS_ERROR = "unknown json mapping
exception";
+
@Override
public Response toResponse(JsonMappingException exception)
{
+ log.warn(exception.getMessage() == null ? UNABLE_TO_PROCESS_ERROR :
exception.getMessage());
return Response.status(Response.Status.BAD_REQUEST)
.entity(ImmutableMap.of(
- "error",
- exception.getMessage() == null ? "unknown json mapping
exception" : exception.getMessage()
+ ERROR_KEY,
+ exception.getMessage() == null
+ ? UNABLE_TO_PROCESS_ERROR
+ :
exception.getMessage().split(System.lineSeparator())[0]
Review Comment:
I donot think so that is the correct approach. We can eat up important bits
of information which are helpful for debugging purposes. A well crafted error
will suddenly look weird.
--
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]