Skip to content

Commit

Permalink
🐛 [Fix] AuthException 사용하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi3226 committed Jan 17, 2025
1 parent 0e0c8e0 commit 27eed79
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gamegoo.gamegoo_v2.core.common.ApiResponse;
import com.gamegoo.gamegoo_v2.core.exception.JwtAuthException;
import com.gamegoo.gamegoo_v2.core.exception.common.ErrorCode;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -31,16 +30,12 @@ protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull Ht
response.setStatus(HttpStatus.UNAUTHORIZED.value());

PrintWriter writer = response.getWriter();
String errorCodeName = authException.getMessage();
ErrorCode code = ErrorCode.valueOf(errorCodeName);

ApiResponse<Object> apiResponse =
ApiResponse.builder()
.code(code.getCode())
.message(code.getMessage())
.data(null)
.status(code.getStatus())
.build();
ApiResponse<Object> apiResponse = ApiResponse.builder()
.code(authException.getCode())
.message(authException.getMessage())
.data(null)
.status(authException.getStatus())
.build();

ObjectMapper objectMapper = new ObjectMapper();
String jsonResponse = objectMapper.writeValueAsString(apiResponse);
Expand Down

0 comments on commit 27eed79

Please sign in to comment.