Skip to content

Commit a12574f

Browse files
committed
refactor: 예외 메시지 구체화
1 parent 942863e commit a12574f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/com/oronaminc/join/question/service/QuestionService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public Question update(Long memberId, Long roomId, Long questionId, QuestionRequ
9090

9191
// 작성자가 아님
9292
if (!question.getMember().getId().equals(memberId)) {
93-
throw new ErrorException(ErrorCode.UNAUTHORIZED_EDIT_QUESTION);
93+
throw ErrorException.of(ErrorCode.UNAUTHORIZED_EDIT_QUESTION,
94+
"{}번 회원은 {}번 질문을 수정할 권한이 없습니다.", memberId, questionId);
9495
}
9596

9697
question.updateContent(request.content());
@@ -104,13 +105,15 @@ public Long delete(Long memberId, Long roomId, Long questionId) {
104105

105106
// 참여자가 아님
106107
if (!participantReader.existsByRoomIdAndMemberId(roomId, memberId)) {
107-
throw new ErrorException(ErrorCode.NOT_FOUND_PARTICIPANT);
108+
throw ErrorException.of(ErrorCode.NOT_FOUND_PARTICIPANT,
109+
"{}번 발표방에는 {}번 회원이 잠가 중이지 않습니다.", roomId, memberId);
108110
}
109111

110112
// 관리자가 아님 && 작성자도 아님
111113
if (!participantReader.existsPresenterOrTeamByMemberId(roomId, memberId)
112114
&& !question.getMember().getId().equals(memberId)) {
113-
throw new ErrorException(ErrorCode.UNAUTHORIZED_DELETE_QUESTION);
115+
throw ErrorException.of(ErrorCode.UNAUTHORIZED_DELETE_QUESTION,
116+
"{}번 회원은 {}번 질문을 삭제할 권한이 없습니다.", memberId, questionId);
114117
}
115118

116119
answerService.deleteByQuestion(questionId);

0 commit comments

Comments
 (0)