diff --git a/src/main/kotlin/roomescape/reservation/exception/ReservationErrorCode.kt b/src/main/kotlin/roomescape/reservation/exception/ReservationErrorCode.kt new file mode 100644 index 00000000..fc61f9a3 --- /dev/null +++ b/src/main/kotlin/roomescape/reservation/exception/ReservationErrorCode.kt @@ -0,0 +1,20 @@ +package roomescape.reservation.exception + +import org.springframework.http.HttpStatus +import roomescape.common.exception.ErrorCode + +enum class ReservationErrorCode( + override val httpStatus: HttpStatus, + override val errorCode: String, + override val message: String +) : ErrorCode { + RESERVATION_NOT_FOUND(HttpStatus.NOT_FOUND, "R001", "예약을 찾을 수 없어요."), + RESERVATION_DUPLICATED(HttpStatus.BAD_REQUEST, "R002", "이미 같은 예약이 있어요."), + ALREADY_RESERVE(HttpStatus.BAD_REQUEST, "R003", "같은 날짜, 시간, 테마에 대한 예약(대기)는 한 번만 가능해요."), + ALREADY_CONFIRMED(HttpStatus.CONFLICT, "R004", "이미 확정된 예약이에요"), + CONFIRMED_RESERVATION_ALREADY_EXISTS(HttpStatus.CONFLICT, "R005", "이미 확정된 예약이 있어서 승인할 수 없어요."), + PAST_REQUEST_DATETIME(HttpStatus.BAD_REQUEST, "R005", "과거 시간으로 예약할 수 없어요."), + NOT_RESERVATION_OWNER(HttpStatus.FORBIDDEN, "R006", "타인의 예약은 취소할 수 없어요."), + INVALID_SEARCH_DATE_RANGE(HttpStatus.BAD_REQUEST, "R007", "종료 날짜는 시작 날짜 이후여야 해요."), + NO_PERMISSION(HttpStatus.FORBIDDEN, "R008", "접근 권한이 없어요."), +} diff --git a/src/main/kotlin/roomescape/reservation/exception/ReservationException.kt b/src/main/kotlin/roomescape/reservation/exception/ReservationException.kt new file mode 100644 index 00000000..885d39c5 --- /dev/null +++ b/src/main/kotlin/roomescape/reservation/exception/ReservationException.kt @@ -0,0 +1,9 @@ +package roomescape.reservation.exception + +import roomescape.common.exception.ErrorCode +import roomescape.common.exception.RoomescapeExceptionV2 + +class ReservationException( + override val errorCode: ErrorCode, + override val message: String = errorCode.message +) : RoomescapeExceptionV2(errorCode, message)