Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/umc7th/bulk/global/error/GeneralErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public enum GeneralErrorCode implements BaseErrorCode {

//500
INTERNAL_SERVER_ERROR_500(HttpStatus.INTERNAL_SERVER_ERROR, "COMMON500", "서버 내부 오류가 발생했습니다."),

//기록
RECORD_ALREADY_EXISTS(HttpStatus.BAD_REQUEST,"RECORD400", "이미 해당 날짜와 끼니에 대한 기록이 존재합니다."),
MEAL_PLAN_NOT_FOUND(HttpStatus.NOT_FOUND, "RECORD404", "해당 끼니의 식단을 찾을 수 없습니다.");
;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public RecordResponseDto createRecord(RecordRequestDto.Create requestDto) {
.orElse(null);

if (existingRecord != null) {
throw new IllegalArgumentException("이미 해당 날짜와 끼니에 대한 기록이 존재합니다.");
throw new CustomException(GeneralErrorCode.RECORD_ALREADY_EXISTS);
}

// 사용자의 해당 날짜 기록 확인
Expand All @@ -76,7 +76,7 @@ public RecordResponseDto createRecord(RecordRequestDto.Create requestDto) {
requestDto.getDate(), requestDto.getMealType());

if (mealMappings.isEmpty()) {
throw new IllegalArgumentException("해당 끼니의 식단을 찾을 수 없습니다.");
throw new CustomException(GeneralErrorCode.MEAL_PLAN_NOT_FOUND);
}

// 새로운 Record 생성
Expand Down