diff --git a/src/main/java/com/api/TaveShot/global/exception/ErrorType.java b/src/main/java/com/api/TaveShot/global/exception/ErrorType.java index b2939a7..68f64ee 100644 --- a/src/main/java/com/api/TaveShot/global/exception/ErrorType.java +++ b/src/main/java/com/api/TaveShot/global/exception/ErrorType.java @@ -34,6 +34,7 @@ public enum ErrorType { // ------------------------------------------ USER ------------------------------------------ + _USER_NOT_FOUND(NOT_FOUND, "USER_4040", "제공된 토큰으로 사용자를 찾을 수 없습니다.") ; diff --git a/src/main/java/com/api/TaveShot/global/jwt/JwtProvider.java b/src/main/java/com/api/TaveShot/global/jwt/JwtProvider.java index f702017..cb32ea0 100644 --- a/src/main/java/com/api/TaveShot/global/jwt/JwtProvider.java +++ b/src/main/java/com/api/TaveShot/global/jwt/JwtProvider.java @@ -3,6 +3,7 @@ import static com.api.TaveShot.global.constant.OauthConstant.ACCESS_TOKEN_VALID_TIME; import static com.api.TaveShot.global.exception.ErrorType._JWT_EXPIRED; import static com.api.TaveShot.global.exception.ErrorType._JWT_PARSING_ERROR; +import static com.api.TaveShot.global.exception.ErrorType._USER_NOT_FOUND; import com.api.TaveShot.domain.Member.repository.MemberRepository; import com.api.TaveShot.global.exception.ApiException; @@ -85,7 +86,8 @@ public void getAuthenticationFromToken(final String jwtToken) { // token 으로부터 유저 정보 확인 private void getGitLoginId(final String jwtToken) { Long userId = Long.valueOf(getUserIdFromToken(jwtToken)); - memberRepository.findById(userId).orElseThrow(() -> new RuntimeException("token 으로 Member를 찾을 수 없음")); + memberRepository.findById(userId) + .orElseThrow(() -> new ApiException(_USER_NOT_FOUND)); } // 토큰에서 유저 아이디 얻기