-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding custom mapper for json processing exception #2264
Conversation
{ | ||
return Response.status(Response.Status.BAD_REQUEST).entity(ImmutableMap.of("Error", arg0.getMessage())).build(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add it thanks
85585de
to
2cb0631
Compare
Updated the pull request with customizing JsonMappingException instead of JsonProcessingException as the former one is more appropriate for problems related to mapping content. Before/After output is below. |
Thanks for the contrib @himank. Will try to review shortly |
@fjy Thanks :) |
@fjy If you get chance could you please review it, Thanks in advance. |
public Response toResponse(JsonMappingException exception) | ||
{ | ||
return Response.status(Response.Status.BAD_REQUEST) | ||
.entity(ImmutableMap.of("Error", exception.getMessage())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other places use "error"
lower case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also should probably be exception.getMessage() == null ? "unknown json mapping exception" : exception.getMessage()
or similar
👍 after minor comments |
Thanks for the contrib @himank . Could you please fill out the CLA at http://druid.io/community/cla.html ? |
…est instead of 500
2cb0631
to
1a5d4e7
Compare
@drcrallen Thanks for the review, updated as per your comments. Please review when you get chance :) |
👍 |
Adding custom mapper for json processing exception
@himank do you mind following the steps here? https://groups.google.com/forum/#!topic/druid-development/1Zs3Vd9LHCQ so your contribution will be counted :) |
Custom exception mapper to return bad request instead of returning 500.