Repository navigation
[Bug] 없는 리소스·잘못된 요청의 500 응답을 404/400으로 정리 (#29) - #35
Merged
Merged
Conversation
- GeneralErrorCode에 HUMMING/MELODY/GENERATION/TASK 404, UPLOAD 400, COMMON405 추가 - MEMBER_NOT_FOUND를 404로 변경 (코드 문자열 MEMBER4000 유지) - 서비스의 IllegalArgumentException을 GeneralException으로 교체 - 모든 @RequestBody에 @Valid 추가, 필수 필드에 검증 제약 부여 - MethodArgumentNotValid/읽기 실패/타입 불일치(400), 메서드 불일치(405) 핸들러 추가 - 500 응답에서 내부 예외 메시지 제거 (로그에만 기록) - 에러 응답 Content-Type을 JSON으로 명시해 SSE 엔드포인트에서도 본문 출력 - Swagger 에러 응답 예시 갱신, MockMvc 통합 테스트 추가 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
개요
존재하지 않는 리소스 조회와 잘못된 요청 값이 404/400이 아닌 500(
COMMON500)으로 응답되고, 500 응답의result에 내부 예외 메시지가 노출되던 문제를 수정합니다.Closes #29
변경 사항
GeneralErrorCode):HUMMING4000,MELODY4000,GENERATION4000,TASK4000(404),UPLOAD4000(400),COMMON405(405)MEMBER_NOT_FOUND400 → 404 (코드 문자열MEMBER4000유지)IllegalArgumentException을GeneralException으로 교체 (허밍, 멜로디 악보, 생성곡, 태스크 조회)@RequestBody에@Valid추가, 필수 필드에 제약 부여 (device_id,humming_id,prompt,notes,file_key,audio_name,content_type,generated_audio_url)AiTaskCompletionRequest의 compact constructor 검증을@NotBlank로 교체Exception핸들러:result를null로 반환, 메시지·스택은 로그에만 기록Accept: text/event-stream인 SSE 엔드포인트에서 에러 본문을 쓰지 못하던 문제 해결HUMMING404,AUTH401포함)프론트 영향
COMMON400(검증 실패 시result에{필드명: 메시지})HUMMING4000,MELODY4000,GENERATION4000,TASK4000)silent-refresh에서 사용자 없음MEMBER4000)COMMON405resultnull(표시용 문구는message사용)SSE(
EventSource)는 404 응답 시onerror만 호출되고 본문은 읽을 수 없습니다.범위 외
테스트
./gradlew test통과 (MockMvc + H2, 신규 16개 포함 17개)bootRun에서 이슈 재현 절차 확인 (device_id누락 400, 없는humming_id404, 내부 메시지 미노출)Accept: text/event-stream으로 없는task_id구독 시 404 JSON 응답 확인guest-login정상 케이스로만 확인)🤖 Generated with Claude Code