Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ExceptionHandler(HttpMessageNotReadableException.class)
- @ResponseStatus(value = HttpStatus.BAD_REQUEST)
- @ResponseBody
- protected ErrorMessage handleJsonException(final HttpMessageNotReadableException ex, final HttpServletRequest request)
- {
- if (ex.getCause() instanceof JsonParseException)
- {
- // some code
- }
- if (ex .getCause() instanceof JsonMappingException)
- {
- // some code
- }
- }
- {firstName":"abc","lastName":"xyz"}
- Throwable throwable = ex.getCause();
- String field = invalidFormatException.getTargetType().getTypeName();
- String message = invalidFormatException.getOriginalMessage();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement