Created
March 31, 2019 16:07
-
-
Save namila007/a3d594354bca66c7e6d4fd88176164fb to your computer and use it in GitHub Desktop.
handle constrain
This file contains 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
@ExceptionHandler(ConstraintViolationException.class) | |
@ResponseStatus(value = HttpStatus.BAD_REQUEST) | |
public ResponseEntity<Object> handleConstraintViolationException( ConstraintViolationException e ) | |
{ | |
ApiError apiError = createError( MESSAGE_FOR_INVALID_PARAMETERS_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