Skip to content

Commit eb903fe

Browse files
authored
🐛fix: 리프레시 재발급 예외 처리 수정 (#120)
1 parent 2de2c91 commit eb903fe

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package team.wego.wegobackend.auth.exception;
2+
3+
import team.wego.wegobackend.common.exception.AppErrorCode;
4+
import team.wego.wegobackend.common.exception.AppException;
5+
6+
public class NotFoundRefreshTokenException extends AppException {
7+
8+
public NotFoundRefreshTokenException() {
9+
super(AppErrorCode.NOT_FOUND_TOKEN);
10+
}
11+
12+
}

src/main/java/team/wego/wegobackend/auth/presentation/AuthController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import team.wego.wegobackend.common.response.ApiResponse;
2424
import team.wego.wegobackend.common.security.CustomUserDetails;
2525
import team.wego.wegobackend.common.security.jwt.JwtTokenProvider;
26+
import team.wego.wegobackend.auth.exception.NotFoundRefreshTokenException;
2627

2728
@Slf4j
2829
@RestController
@@ -109,7 +110,7 @@ public ResponseEntity<ApiResponse<String>> withDraw(
109110
public ResponseEntity<ApiResponse<RefreshResponse>> refresh(
110111
@CookieValue(name = "refreshToken", required = false) String refreshToken) {
111112
if (refreshToken == null) {
112-
throw new IllegalArgumentException("Refresh 토큰이 없습니다.");
113+
throw new NotFoundRefreshTokenException();
113114
}
114115

115116
RefreshResponse response = authService.refresh(refreshToken);

src/main/java/team/wego/wegobackend/common/exception/AppErrorCode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public enum AppErrorCode implements ErrorCode {
3434
NOT_FOUND_FOLLOW(HttpStatus.BAD_REQUEST, "회원 : 팔로우 관계를 찾을 수 없습니다."),
3535

3636
EXPIRED_TOKEN(HttpStatus.UNAUTHORIZED, "인증 : 만료된 토큰입니다."),
37-
INVALID_TOKEN(HttpStatus.UNAUTHORIZED, "인증 : 유효하지 않은 토큰입니다.")
37+
INVALID_TOKEN(HttpStatus.UNAUTHORIZED, "인증 : 유효하지 않은 토큰입니다."),
38+
NOT_FOUND_TOKEN(HttpStatus.UNAUTHORIZED, "인증 : 토큰을 찾을 수 없습니다.")
3839
;
3940

4041
private final HttpStatus httpStatus;

0 commit comments

Comments
 (0)