Skip to content

Commit 3536842

Browse files
committed
[feat] 기타 토큰 에러 로직 추가
1 parent faddcaf commit 3536842

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/Ness/Backend/domain/auth/jwt/JwtAuthorizationFilter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
7171
log.error("INVALID_TOKEN_SIGNATURE");
7272
request.setAttribute("exception", ErrorCode.INVALID_TOKEN_SIGNATURE.getCode());
7373
setResponse(response, ErrorCode.INVALID_TOKEN_SIGNATURE);
74+
} catch (Exception e){
75+
log.error("TOKEN_EXCEPTION");
76+
request.setAttribute("exception", ErrorCode.TOKEN_ERROR.getCode());
77+
setResponse(response, ErrorCode.TOKEN_ERROR);
7478
}
7579
}
7680
}

src/main/java/Ness/Backend/global/error/ErrorCode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public enum ErrorCode {
2828
LOGIN_FAILED(UNAUTHORIZED, "AUTH008", "로그인에 실패했습니다."),
2929
INVALID_TOKEN(BAD_REQUEST, "AUTH009", "유효하지 않은 토큰입니다."),
3030
INVALID_TOKEN_SIGNATURE(BAD_REQUEST, "AUTH010", "유효하지 않은 시그니처를 가진 토큰입니다. 온전한 토큰이 맞는지 확인해주세요."),
31-
INVALID_PRINCIPAL(BAD_REQUEST, "AUTH011", "인증정보가 존재하지 않습니다.");
31+
TOKEN_ERROR(BAD_REQUEST, "AUTH011", "기타 토큰 에러입니다."),
32+
INVALID_PRINCIPAL(BAD_REQUEST, "AUTH012", "인증정보가 존재하지 않습니다.");
3233

3334
private final HttpStatus httpStatus;
3435
private final String code;

0 commit comments

Comments
 (0)