Skip to content

Conversation

@LABYRINTH3
Copy link
Contributor

@LABYRINTH3 LABYRINTH3 commented Aug 4, 2025

작업 내용

  • GlobalExceptionHandler 참조 변경 및 파일 중복 해소

변경 사항

  • 수정/추가된 주요 파일이나 로직

테스트 방법

  • Postman, Swagger 등으로 어떻게 테스트했는지

관련 이슈

  • close #이슈번호

특이사항

  • 리뷰 시 반드시 봐야 하는 부분이 있다면

머지 전 필수 체크리스트

  • 제목 형식 지켰음 ([기능] ~)
  • 라벨 지정 완료 (e.g. feature, bugfix)
  • 마일스톤 지정 완료
  • Assignee 지정 완료
  • Reviewer 지정 완료
  • GitHub Actions 테스트 통과 확인

체크리스트가 모두 완료되지 않으면 merge 하지 마시오

Summary by CodeRabbit

  • 버그 수정
    • 예외 처리 시 반환되는 실패 응답 객체 생성 방식이 개선되어, 오류 발생 시 일관된 응답을 제공합니다.

@LABYRINTH3 LABYRINTH3 linked an issue Aug 4, 2025 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Walkthrough

GlobalExceptionHandler.java에서 ApiResponse의 import 경로가 변경되었고, 예외 처리 메서드 내에서 사용하던 fail 메서드 호출이 onFailure로 대체되었습니다. HTTP 상태 코드 및 에러 메시지 처리 방식은 변하지 않았습니다.

Changes

Cohort / File(s) Change Summary
ApiResponse 사용 및 메서드 변경
src/main/java/umc/snack/common/exception/GlobalExceptionHandler.java
ApiResponse import 경로를 dto로 변경하고, 예외 처리 메서드에서 failonFailure로 메서드 호출을 수정함.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

Poem

🐰
예외가 와도 걱정 마,
onFailure로 답을 주니,
import 경로 바꿔주고
코드가 한층 깔끔해졌지!
토끼도 안심하고 뛰어놀 수 있겠네.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/GlobalExceptionHandler-duplication-resolve

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a629300 and 429b5f8.

📒 Files selected for processing (1)
  • src/main/java/umc/snack/common/exception/GlobalExceptionHandler.java (4 hunks)
🔇 Additional comments (2)
src/main/java/umc/snack/common/exception/GlobalExceptionHandler.java (2)

14-54: 예외 처리 로직의 일관성이 잘 유지되었습니다.

모든 예외 핸들러 메서드에서 다음과 같이 변경사항이 일관되게 적용되었습니다:

  • HTTP 상태 코드 처리 로직 유지
  • 에러 메시지 처리 방식 동일
  • 응답 구조 변경 없음
  • 메서드 호출만 onFailure로 업데이트

이러한 리팩토링은 기존 기능을 유지하면서 API 일관성을 개선합니다.


19-19: ✅ ApiResponse 메서드 변경 검증 완료

  • ApiResponse.java(src/main/java/umc/snack/common/dto/ApiResponse.java)에서 onFailure 메서드 정의 확인
  • fail 메서드 정의 및 호출이 코드베이스에 더 이상 존재하지 않음 확인
  • 모든 ApiResponse.onFailure 호출이 일관되게 적용된 것 확인

기존 로직에 영향 없이 메서드명이 안전하게 변경되었으므로 추가 작업은 필요하지 않습니다.

import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import umc.snack.common.response.ApiResponse;
import umc.snack.common.dto.ApiResponse;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

import 경로 변경을 전체 코드베이스에서 검증하세요.

ApiResponse 클래스의 import 경로가 umc.snack.common.response.ApiResponse에서 umc.snack.common.dto.ApiResponse로 변경되었습니다. 이는 파일 중복 해소와 관련된 패키지 재구성으로 보입니다.

다음 스크립트를 실행하여 변경사항이 일관되게 적용되었는지 확인하세요:


🏁 Script executed:

#!/bin/bash
# 설명: ApiResponse import 경로 변경이 일관되게 적용되었는지 확인

# 이전 import 경로가 여전히 사용되고 있는지 확인
echo "=== 이전 import 경로 사용 확인 ==="
rg "umc\.snack\.common\.response\.ApiResponse" --type java

# 새로운 import 경로 사용 확인
echo -e "\n=== 새로운 import 경로 사용 확인 ==="
rg "umc\.snack\.common\.dto\.ApiResponse" --type java

# ApiResponse 클래스 파일 위치 확인
echo -e "\n=== ApiResponse 클래스 파일 위치 확인 ==="
fd "ApiResponse.java"

Length of output: 2204


ApiResponse import 경로 불일치 발견 및 수정 필요

다음 파일에서 아직 이전 패키지 경로를 사용하고 있어 일관성이 깨집니다.
모든 곳에서 umc.snack.common.dto.ApiResponse로 통일해주세요.

  • 수정 대상

    • src/main/java/umc/snack/controller/article/ArticleController.java (라인 9)
  • 변경 예시

    - import umc.snack.common.response.ApiResponse;
    + import umc.snack.common.dto.ApiResponse;

추가로, 이제 더 이상 사용되지 않는 src/main/java/umc/snack/common/response/ApiResponse.java 파일은 삭제하거나 dto 패키지의 구현으로 통합하는 방안을 검토해주세요.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/main/java/umc/snack/controller/article/ArticleController.java at line 9,
update the import statement for ApiResponse to use the correct package path
umc.snack.common.dto.ApiResponse instead of the old one. Also, consider removing
or refactoring the unused
src/main/java/umc/snack/common/response/ApiResponse.java file to avoid confusion
and maintain consistency.

@danaggero danaggero merged commit 36c87f4 into develop Aug 4, 2025
1 check passed
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.

[fix] GlobalExceptionHandler 참조 변경 및 중복 파일 중복 일부 해소

3 participants