Skip to content

Commit 4ba392a

Browse files
committed
feat(JwtExceptionFilter): 예외 처리를 일관성 있도록 변경
- 로그 추가
1 parent 3475461 commit 4ba392a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/com/somemore/auth/jwt/filter/JwtExceptionFilter.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public class JwtExceptionFilter extends OncePerRequestFilter {
2424
private final ObjectMapper objectMapper;
2525

2626
@Override
27-
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
27+
protected void doFilterInternal(HttpServletRequest request,
28+
HttpServletResponse response,
29+
FilterChain filterChain) throws ServletException, IOException {
2830
try {
2931
filterChain.doFilter(request, response);
3032
} catch (JwtException e) {
@@ -42,8 +44,10 @@ private void configureUnauthorizedResponse(HttpServletResponse response) {
4244
}
4345

4446
private ProblemDetail buildUnauthorizedProblemDetail(JwtException e) {
45-
ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.UNAUTHORIZED, e.getMessage());
46-
problemDetail.setTitle("Authentication Error");
47+
log.error("JwtFilter 예외 발생: {}", e.getMessage());
48+
49+
ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.UNAUTHORIZED, "인증에서 오류가 발생했습니다.");
50+
problemDetail.setTitle("인증 에러");
4751
problemDetail.setProperty("timestamp", System.currentTimeMillis());
4852
return problemDetail;
4953
}

0 commit comments

Comments
 (0)