Skip to content

Commit

Permalink
fix: 예외 메시지 적용 (#139)
Browse files Browse the repository at this point in the history
* fix: 예외 메시지 enum으로 변경

* fix: 에러 메시지 수정

* style: spotless 적용
  • Loading branch information
simhani1 committed Aug 15, 2023
1 parent d737dc4 commit 2290389
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.ohdab.classroom.repository.ClassroomRepository;
import com.ohdab.classroom.service.dto.AddStudentDto;
import com.ohdab.classroom.service.usecase.AddStudentUsecase;
import com.ohdab.core.exception.ExceptionEnum;
import com.ohdab.member.domain.Member;
import com.ohdab.member.domain.student.studentid.StudentId;
import com.ohdab.member.exception.NoMemberException;
Expand Down Expand Up @@ -42,7 +43,8 @@ public void addStudent(AddStudentDto.Request addStudentReq) {
private Classroom findClassroomById(long classroomId) {
return classroomRepository
.findById(classroomId)
.orElseThrow(() -> new NoClassroomException("존재하지 않는 반입니다."));
.orElseThrow(
() -> new NoClassroomException(ExceptionEnum.NO_CLASSROOM.getMessage()));
}

private void publishStudentAddedEvent(String studentName) {
Expand All @@ -52,7 +54,7 @@ private void publishStudentAddedEvent(String studentName) {
private Member findMemberByName(String studentName) {
return memberRepository
.findByMemberInfoName(studentName)
.orElseThrow(() -> new NoMemberException("존재하지 않는 회원입니다."));
.orElseThrow(() -> new NoMemberException(ExceptionEnum.NO_MEMBER.getMessage()));
}

private void createMistakeNoteForAddedStudent(Classroom classroom, Member student) {
Expand Down

0 comments on commit 2290389

Please sign in to comment.