feat: 새로 사용할 커스텀 예외 객체 및 예외 코드 정의

This commit is contained in:
이상진 2025-07-23 11:04:11 +09:00
parent 830d3712e8
commit 7c30100f5a
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package roomescape.common.exception
import org.springframework.http.HttpStatus
enum class CommonErrorCode(
override val httpStatus: HttpStatus,
override val errorCode: String,
override val message: String,
) : ErrorCode {
INVALID_INPUT_VALUE(
httpStatus = HttpStatus.BAD_REQUEST,
errorCode = "C001",
message = "요청 값이 잘못되었어요."
),
UNEXPECTED_SERVER_ERROR(
httpStatus = HttpStatus.INTERNAL_SERVER_ERROR,
errorCode = "C999",
message = "서버에 예상치 못한 오류가 발생했어요. 관리자에게 문의해주세요.",
),
}

View File

@ -0,0 +1,9 @@
package roomescape.common.exception
import org.springframework.http.HttpStatus
interface ErrorCode {
val httpStatus: HttpStatus
val errorCode: String
val message: String
}

View File

@ -0,0 +1,6 @@
package roomescape.common.exception
open class RoomException(
open val errorCode: ErrorCode,
override val message: String? = errorCode.message
) : RuntimeException(message)