return token expiration time up to 15 min
@@ -7,6 +7,7 @@ import greencity.dto.comment.CommentReturnDto;
import greencity.entity.Place;
import greencity.entity.User;
import greencity.entity.enums.UserStatus;
+import greencity.exception.BadEmailException;
import greencity.exception.NotFoundException;
import greencity.exception.UserBlockedException;
import greencity.service.PlaceCommentService;
@@ -52,7 +53,7 @@ public class PlaceCommentController {
@Valid @RequestBody AddCommentDto addCommentDto) {
Principal principal = SecurityContextHolder.getContext().getAuthentication();
User user = userService.findByEmail(principal.getName())
- .orElseThrow(() -> new NotFoundException(ErrorMessage.USER_NOT_FOUND_BY_EMAIL + principal.getName()));
+ .orElseThrow(() -> new BadEmailException(ErrorMessage.USER_NOT_FOUND_BY_EMAIL + principal.getName()));
if (user.getUserStatus().equals(UserStatus.BLOCKED)) {
throw new UserBlockedException(ErrorMessage.USER_HAS_BLOCKED_STATUS);
}
