generated from pricelees/issue-pr-template
feat: 인증 도메인(Auth)에서 사용할 커스텀 예외 및 코드 추가
This commit is contained in:
parent
7c30100f5a
commit
ef05a3ff9f
18
src/main/kotlin/roomescape/auth/exception/AuthErrorCode.kt
Normal file
18
src/main/kotlin/roomescape/auth/exception/AuthErrorCode.kt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package roomescape.auth.exception
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus
|
||||||
|
import roomescape.common.exception.ErrorCode
|
||||||
|
|
||||||
|
enum class AuthErrorCode(
|
||||||
|
override val httpStatus: HttpStatus,
|
||||||
|
override val errorCode: String,
|
||||||
|
override val message: String,
|
||||||
|
): ErrorCode {
|
||||||
|
LOGIN_REQUIRED(HttpStatus.UNAUTHORIZED, "A001", "로그인이 필요해요."),
|
||||||
|
LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "A002", "로그인에 실패했어요."),
|
||||||
|
TOKEN_NOT_FOUND(HttpStatus.UNAUTHORIZED, "A003", "인증 토큰이 없어요."),
|
||||||
|
INVALID_TOKEN(HttpStatus.UNAUTHORIZED, "A004", "유효하지 않은 토큰이에요."),
|
||||||
|
EXPIRED_TOKEN(HttpStatus.UNAUTHORIZED, "A005", "토큰이 만료됐어요."),
|
||||||
|
USER_NOT_FOUND_FROM_TOKEN(HttpStatus.UNAUTHORIZED, "A006", "토큰으로 회원 정보를 찾을 수 없어요."),
|
||||||
|
ACCESS_DENIED(HttpStatus.FORBIDDEN, "A007", "접근 권한이 없어요."),
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package roomescape.auth.exception
|
||||||
|
|
||||||
|
import roomescape.common.exception.RoomException
|
||||||
|
|
||||||
|
class AuthException(
|
||||||
|
override val errorCode: AuthErrorCode,
|
||||||
|
override val message: String? = errorCode.message
|
||||||
|
) : RoomException(errorCode, message)
|
||||||
Loading…
x
Reference in New Issue
Block a user