@ExceptionHandler({ InvalidEntityConstraintsException.class, InvalidIdException.class, EntityAlreadyExistsException.class, AssociationAlreadyExistsException.class }) public ResponseEntity<?> handleBadRequests(CustomException e) { return new ResponseEntity<>(e.getErrorMessage(), HttpStatus.BAD_REQUEST); }
@ExceptionHandler({EntityNotFoundException.class, AssociationNotFoundException.class}) public ResponseEntity<?> handleNotFounds(CustomException e) { return new ResponseEntity<>(e.getErrorMessage(), HttpStatus.NOT_FOUND); }