Skip to content

Commit

Permalink
add : 3차 세미나 실습 과제_ 커스텀 Exception ValidateException 추가 #7
Browse files Browse the repository at this point in the history
  • Loading branch information
PicturePark1101 committed May 1, 2024
1 parent 16addf4 commit 7af1dd6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.demo.exception;

import com.example.demo.common.dto.ErrorMessage;

public class ValidateException extends BusinessException {

public ValidateException(ErrorMessage errorMessage) {
super(errorMessage);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.example.demo.domain.Blog;
import com.example.demo.domain.Member;
import com.example.demo.exception.NotFoundException;
import com.example.demo.exception.ValidateException;
import com.example.demo.repository.BlogRepository;
import com.example.demo.service.dto.blog.BlogCreateRequest;
import com.example.demo.service.dto.blog.BlogTitleUpdateRequest;
Expand Down Expand Up @@ -40,7 +41,7 @@ public void updateTitle(Long blogId, BlogTitleUpdateRequest blogTitleUpdateReque

public void validateOwner(Long requestMemberId, Long findMemberId) {
if (!requestMemberId.equals(findMemberId)) {
throw new NotFoundException(ErrorMessage.BLOG_UNAUTHORIZED);
throw new ValidateException(ErrorMessage.BLOG_UNAUTHORIZED);
}
}
}

0 comments on commit 7af1dd6

Please sign in to comment.