Skip to content

Instantly share code, notes, and snippets.

@namila007
Created March 31, 2019 18:40
Show Gist options
  • Save namila007/ab69c4f1c0e836f416b042b1bc9e2ef2 to your computer and use it in GitHub Desktop.
Save namila007/ab69c4f1c0e836f416b042b1bc9e2ef2 to your computer and use it in GitHub Desktop.
valid body
@Override
@ResponseStatus(HttpStatus.BAD_REQUEST)
protected ResponseEntity<Object> handleMethodArgumentNotValid( MethodArgumentNotValidException e,
HttpHeaders headers, HttpStatus status, WebRequest request )
{
ApiError apiError = createError( MESSAGE_FOR_INVALID_BODY_ERROR, HttpStatus.BAD_REQUEST, e );
return new ResponseEntity<>( apiError, apiError.getStatus() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment