Skip to content

fix: 요청 오류 예외를 500 대신 400 으로 응답 - #29

Closed
hyeonszz wants to merge 1 commit into
mainfrom
fix/missing-header-400
Closed

fix: 요청 오류 예외를 500 대신 400 으로 응답#29
hyeonszz wants to merge 1 commit into
mainfrom
fix/missing-header-400

Conversation

@hyeonszz

@hyeonszz hyeonszz commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

필수 헤더 누락 / 본문 파싱 실패 / 파라미터 타입 불일치는 400 으로 매핑한다.
명시 핸들러가 없으면 catch-all 이 이들을 500 으로 처리한다.

  • MissingRequestHeaderException → reasons 에 헤더명
  • HttpMessageNotReadableException
  • MethodArgumentTypeMismatchException

검증: 헤더 없이 GET /api/missions/today(/status) 호출 시 400 + 헤더명 응답 확인. clean build 통과.

Summary by CodeRabbit

  • 버그 수정
    • 필수 요청 헤더가 누락된 경우 명확한 오류 메시지와 함께 400 오류를 반환합니다.
    • 요청 본문을 읽을 수 없거나 요청 매개변수의 형식이 잘못된 경우 일관된 400 오류 응답을 제공합니다.

필수 헤더 누락 / 본문 파싱 실패 / 파라미터 타입 불일치는 400 으로 매핑한다.
명시 핸들러가 없으면 catch-all 이 이들을 500 으로 처리한다.

- MissingRequestHeaderException  → reasons 에 헤더명
- HttpMessageNotReadableException
- MethodArgumentTypeMismatchException

검증: 헤더 없이 GET /api/missions/today(/status) 호출 시 400 + 헤더명 응답 확인. clean build 통과.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hyeonszz hyeonszz closed this Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ed27e840-79e0-4b72-a7c8-4703fbaeb770

📥 Commits

Reviewing files that changed from the base of the PR and between 60e3425 and 99721e9.

📒 Files selected for processing (1)
  • src/main/java/com/example/hackathon/global/exception/GlobalExceptionHandler.java

📝 Walkthrough

Walkthrough

GlobalExceptionHandler에 필수 헤더 누락, 읽을 수 없는 요청 본문, 인자 타입 불일치 예외를 HTTP 400 응답으로 처리하는 핸들러 3개가 추가되었습니다.

Changes

클라이언트 입력 예외 처리

Layer / File(s) Summary
잘못된 입력 예외 핸들러
src/main/java/com/example/hackathon/global/exception/GlobalExceptionHandler.java
Spring MVC 입력 예외 타입을 추가하고, 예외별 정보와 메시지를 포함한 COMMON_ERROR_400_INVALID_INPUT 응답을 생성합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/missing-header-400

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant