Skip to content

fix(exception): 메소드 검증 실패 시, 500 대신 400 응답하도록 수정#283

Merged
huhdy32 merged 2 commits intodevelopfrom
fix/exception
Jan 22, 2026
Merged

fix(exception): 메소드 검증 실패 시, 500 대신 400 응답하도록 수정#283
huhdy32 merged 2 commits intodevelopfrom
fix/exception

Conversation

@huhdy32
Copy link
Collaborator

@huhdy32 huhdy32 commented Jan 22, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved API error handling for validation failures, now returning consistent error responses with appropriate status codes and error codes when validation issues occur.

✏️ Tip: You can customize this high-level summary in your review settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @huhdy32, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 메소드 검증 실패가 500 내부 서버 오류로 잘못 처리되던 문제를 해결합니다. HandlerMethodValidationException에 대한 전용 예외 처리기를 도입하여, 이제 시스템은 클라이언트에게 더 정확한 피드백을 제공하기 위해 400 Bad Request 상태를 올바르게 반환합니다.

Highlights

  • 예외 처리 개선: 메소드 검증 실패 시 발생하는 HandlerMethodValidationException을 처리하기 위한 새로운 예외 처리기를 추가했습니다.
  • 응답 상태 코드 변경: 메소드 검증 실패 시 500 Internal Server Error 대신 400 Bad Request 상태 코드를 반환하도록 수정했습니다.
  • 로깅 강화: 검증 실패 시 exception.getCrossParameterValidationResults()를 포함한 상세한 경고 로그를 남기도록 했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

A new exception handler method was added to ApiExceptionHandler to handle HandlerMethodValidationException. The method logs cross-parameter validation results and returns HTTP 400 with status code 1000, mirroring the existing ConstraintViolationException handler.

Changes

Cohort / File(s) Summary
Exception Handling
app/api/mathrank-api-common/src/main/java/kr/co/mathrank/app/api/common/exception/ApiExceptionHandler.java
Added handleValidationException() method to handle HandlerMethodValidationException with validation logging and HTTP 400 response (code 1000)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A handler hops in, validation's in sight,
Cross-parameters checked, errors set right,
Code 1000 whispers with message so bright,
Exception handling hopping through night! 🌙

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding exception handling for method validation failures to return 400 status instead of 500.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

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

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 PR은 메소드 인자 유효성 검사 실패 시 500 오류 대신 400 오류를 반환하도록 HandlerMethodValidationException에 대한 예외 핸들러를 추가합니다. 변경 사항은 올바르며 PR의 목적을 잘 달성합니다. 코드의 일관성과 유지보수성을 향상시키기 위해 몇 가지 작은 개선 사항을 제안합니다. 로그 메시지 형식을 통일하고, 하드코딩된 에러 코드를 상수로 추출하는 것을 고려해주세요.

@huhdy32 huhdy32 enabled auto-merge (squash) January 22, 2026 05:09
@huhdy32 huhdy32 merged commit 9e733f4 into develop Jan 22, 2026
2 checks passed
@huhdy32 huhdy32 deleted the fix/exception branch January 22, 2026 05:14
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