Repository navigation
fix: 클라이언트 요청 오류를 500 대신 알맞은 4xx로 응답한다 - #144
Merged
Merged
Conversation
- 405·415·406·헤더 누락 등 Spring MVC 예외는 자신의 4xx 상태로 응답한다(이전에는 전부 500과 ERROR 로그).
- 필수 쿼리 파라미터 누락은 파라미터 이름을 담아 400, 경로·쿼리 값 형식 오류(숫자 아닌 id, 없는 enum 값)와
없는 필드로의 정렬도 400으로 응답한다.
- 도메인 예외의 getMessage()가 예외 타입 메시지를 돌려줘, 로그에 message=null이 남던 문제를 고친다.
- 응답 본문 형식({message})은 그대로다.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
GlobalExceptionHandler가 처리하지 않는 Spring MVC 예외가 모두 마지막Exception처리기로 떨어져, 클라이언트가 잘못 보낸 요청이 500 + ERROR 스택 로그가 됐다. 예:GET /v1/admin/images에purpose를 빼면 500.변경 (응답 본문
{message}형식은 그대로)필수 요청 파라미터 'purpose'가 없습니다.'buildId'의 형식이 올바르지 않습니다.sortErrorResponse를 구현한 예외가 4xx 상태를 갖고 있으면 그 상태로 응답하고 WARN으로 남긴다. 진짜 서버 오류만 500·ERROR로 남는다.BcsdException.getMessage()가 예외 타입 메시지를 돌려준다. 생성자가 메시지를 넘기지 않아 모든 도메인 예외 로그가message=null이었다.테스트
ClientErrorStatusIntegrationTest(405, 415, 형식 오류 id, 필수 파라미터 누락),AdminImageIntegrationTest에 3건(purpose 누락, 없는 purpose 값, 없는 정렬 필드),BcsdExceptionTest../gradlew test: 540건 중 539 통과, 1 스킵.