コード例 #1
0
 @ExceptionHandler({
   InvalidEntityConstraintsException.class,
   InvalidIdException.class,
   EntityAlreadyExistsException.class,
   AssociationAlreadyExistsException.class
 })
 public ResponseEntity<?> handleBadRequests(CustomException e) {
   return new ResponseEntity<>(e.getErrorMessage(), HttpStatus.BAD_REQUEST);
 }
コード例 #2
0
 @ExceptionHandler({EntityNotFoundException.class, AssociationNotFoundException.class})
 public ResponseEntity<?> handleNotFounds(CustomException e) {
   return new ResponseEntity<>(e.getErrorMessage(), HttpStatus.NOT_FOUND);
 }