Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/integration' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ChoiWonYu committed Sep 10, 2024
2 parents 7d326fc + 6a423d8 commit 947cc5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void validateDifficulties(final List<Difficulty> difficulties) {
@ExampleObject(name = "클라이밍장 없음", value = "{\"error\": \"아이디가 1인 클라이밍장을 찾을 수 없습니다.\"}")
}))
})
@GetMapping("/{gymId}")
@GetMapping("/gyms/{gymId}")
public ResponseEntity<ClimbingGymDetailResponseDto> getGymDetails(
@PathVariable final Long gymId) {
return ResponseEntity.ok(climbingGymService.findClimbingGymDetail(gymId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.filter.OncePerRequestFilter;

@Slf4j
public class TokenExceptionFilter extends OncePerRequestFilter {

@Override
Expand All @@ -22,11 +24,15 @@ protected void doFilterInternal(final HttpServletRequest request,
handleResponse(response, HttpServletResponse.SC_UNAUTHORIZED, exception.getMessage());
} catch (final MemberNotFoundException exception) {
handleResponse(response, HttpServletResponse.SC_NOT_FOUND, exception.getMessage());
} catch (final RuntimeException exception) {
handleResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
exception.getMessage());
}
}

private static void handleResponse(final HttpServletResponse response, final int scNotFound,
final String exception) throws IOException {
log.error(exception);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=UTF-8");
response.setStatus(scNotFound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint
@Override
public void commence(final HttpServletRequest request, final HttpServletResponse response,
final AuthenticationException authException) throws IOException, ServletException {
log.error(authException.getMessage());
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getWriter().write(authException.getMessage());
}
Expand Down

0 comments on commit 947cc5c

Please sign in to comment.