feat: 인증 도메인(Auth)에서 사용할 커스텀 예외 및 코드 추가

This commit is contained in:
이상진 2025-07-23 11:04:43 +09:00
parent 7c30100f5a
commit ef05a3ff9f
2 changed files with 26 additions and 0 deletions

View 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", "접근 권한이 없어요."),
}

View File

@ -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)