diff --git a/src/main/java/com/stumeet/server/studymember/application/service/StudyMemberValidationService.java b/src/main/java/com/stumeet/server/studymember/application/service/StudyMemberValidationService.java index c9e1b847..ce3641c3 100644 --- a/src/main/java/com/stumeet/server/studymember/application/service/StudyMemberValidationService.java +++ b/src/main/java/com/stumeet/server/studymember/application/service/StudyMemberValidationService.java @@ -19,21 +19,21 @@ public class StudyMemberValidationService implements StudyMemberValidationUseCas @Override public void checkStudyJoinMember(Long studyId, Long memberId) { if (studyMemberValidationPort.isNotStudyJoinMember(studyId, memberId)) { - throw new StudyMemberNotJoinedException("스터디에 가입된 멤버가 아닙니다. 전달받은 studyId=" + studyId + ", memberId=" + memberId); + throw new StudyMemberNotJoinedException(studyId, memberId); } } @Override public void checkAlreadyStudyJoinMember(Long studyId, Long memberId) { if (studyMemberValidationPort.isAlreadyStudyJoinMember(studyId, memberId)) { - throw new AlreadyStudyJoinMemberException("스터디에 이미 가입한 멤버입니다. 전달받은 studyId=" + studyId + ", memberId=" + memberId); + throw new AlreadyStudyJoinMemberException(studyId, memberId); } } @Override public void checkAdmin(Long studyId, Long adminId) { if (studyMemberValidationPort.isNotAdmin(studyId, adminId)) { - throw new NotStudyAdminException("스터디 관리자가 아닙니다. 전달받은 studyId=" + studyId + ", adminId=" + adminId); + throw new NotStudyAdminException(studyId, adminId); } } } diff --git a/src/main/java/com/stumeet/server/studymember/domain/exception/AlreadyStudyJoinMemberException.java b/src/main/java/com/stumeet/server/studymember/domain/exception/AlreadyStudyJoinMemberException.java index 2877a6d3..a7b73120 100644 --- a/src/main/java/com/stumeet/server/studymember/domain/exception/AlreadyStudyJoinMemberException.java +++ b/src/main/java/com/stumeet/server/studymember/domain/exception/AlreadyStudyJoinMemberException.java @@ -3,8 +3,11 @@ import com.stumeet.server.common.exception.model.InvalidStateException; import com.stumeet.server.common.response.ErrorCode; +import java.text.MessageFormat; + public class AlreadyStudyJoinMemberException extends InvalidStateException { - public AlreadyStudyJoinMemberException(String message) { - super(message, ErrorCode.ALREADY_STUDY_JOIN_MEMBER_EXCEPTION); + private static final String MESSAGE = "이미 스터디에 가입한 멤버입니다. studyId={0}, memberId={1}"; + public AlreadyStudyJoinMemberException(Long studyId, Long memberId) { + super(MessageFormat.format(MESSAGE, studyId, memberId), ErrorCode.ALREADY_STUDY_JOIN_MEMBER_EXCEPTION); } } diff --git a/src/main/java/com/stumeet/server/studymember/domain/exception/NotStudyAdminException.java b/src/main/java/com/stumeet/server/studymember/domain/exception/NotStudyAdminException.java index 3d30ec64..7955cda7 100644 --- a/src/main/java/com/stumeet/server/studymember/domain/exception/NotStudyAdminException.java +++ b/src/main/java/com/stumeet/server/studymember/domain/exception/NotStudyAdminException.java @@ -3,9 +3,13 @@ import com.stumeet.server.common.exception.model.InvalidStateException; import com.stumeet.server.common.response.ErrorCode; +import java.text.MessageFormat; + public class NotStudyAdminException extends InvalidStateException { - public NotStudyAdminException(String message) { - super(message, ErrorCode.NOT_STUDY_ADMIN_EXCEPTION); + + private static final String MESSAGE = "스터디 관리자가 아닙니다. 전달받은 studyId={0}, memberId={1}"; + public NotStudyAdminException(Long studyId, Long memberId) { + super(MessageFormat.format(MESSAGE, studyId, memberId), ErrorCode.NOT_STUDY_ADMIN_EXCEPTION); } } diff --git a/src/main/java/com/stumeet/server/studymember/domain/exception/StudyMemberNotJoinedException.java b/src/main/java/com/stumeet/server/studymember/domain/exception/StudyMemberNotJoinedException.java index 0d040e51..c90bb9cc 100644 --- a/src/main/java/com/stumeet/server/studymember/domain/exception/StudyMemberNotJoinedException.java +++ b/src/main/java/com/stumeet/server/studymember/domain/exception/StudyMemberNotJoinedException.java @@ -3,9 +3,11 @@ import com.stumeet.server.common.exception.model.InvalidStateException; import com.stumeet.server.common.response.ErrorCode; -public class StudyMemberNotJoinedException extends InvalidStateException { +import java.text.MessageFormat; - public StudyMemberNotJoinedException(String message) { - super(message, ErrorCode.STUDY_MEMBER_NOT_JOINED_EXCEPTION); +public class StudyMemberNotJoinedException extends InvalidStateException { + private static final String MESSAGE = "스터디에 가입된 멤버가 아닙니다. 전달받은 studyId={0}, memberId={1}"; + public StudyMemberNotJoinedException(Long studyId, Long memberId) { + super(MessageFormat.format(MESSAGE, studyId, memberId), ErrorCode.STUDY_MEMBER_NOT_JOINED_EXCEPTION); } }