Created
July 18, 2019 19:21
-
-
Save KiryhaPikoff/6e24fa270d86c04cfcf49e4b2fef4377 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ResponseBody | |
| @ExceptionHandler(MethodArgumentNotValidException.class) | |
| public ResponseEntity<StringBuilder> processValidationError(HttpServletRequest httpServletRequest, MethodArgumentNotValidException manve) throws MethodArgumentNotValidException { | |
| StringBuilder response = new StringBuilder(); | |
| for (ObjectError oe : manve.getBindingResult().getAllErrors() ) { | |
| response.append(oe.getDefaultMessage() + "\n"); | |
| } | |
| return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment