Skip to content

Instantly share code, notes, and snippets.

@KiryhaPikoff
Created July 17, 2019 07:33
Show Gist options
  • Save KiryhaPikoff/4d49fc52db1bef1c8b79e31fbb08b39e to your computer and use it in GitHub Desktop.
Save KiryhaPikoff/4d49fc52db1bef1c8b79e31fbb08b39e to your computer and use it in GitHub Desktop.
@ResponseBody
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<List<ObjectError>> processValidationError(HttpServletRequest httpServletRequest, MethodArgumentNotValidException manve) throws MethodArgumentNotValidException {
return new ResponseEntity<>(manve.getBindingResult().getAllErrors(), HttpStatus.BAD_REQUEST);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment