[refactor] BusinessException 문자열 사용 제거 및 에러 로깅 개선#85
Conversation
Summary of ChangesHello @k3vin7, 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! 이 PR은 애플리케이션 전반의 에러 처리 방식을 표준화하고 개선하기 위한 리팩토링입니다. 기존에 BusinessException에 직접 문자열을 사용하던 패턴을 도메인별 에러 코드로 대체하여 에러 메시지의 일관성을 확보하고, 에러 로깅을 강화하여 문제 발생 시 진단 효율성을 높였습니다. 이를 통해 코드의 유지보수성과 안정성이 향상될 것으로 기대됩니다. Highlights
🧠 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. Changelog
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
안녕하세요. 전반적으로 매우 훌륭한 리팩토링입니다! BusinessException에서 문자열을 직접 사용하던 부분을 도메인별 에러 코드로 대체하여 코드의 유지보수성과 일관성을 크게 향상시켰습니다. 또한 로깅을 개선하려는 노력도 좋습니다.
한 가지 제안 사항으로, GlobalExceptionHandler의 로그 메시지 형식을 조금 더 개선하면 중복을 줄이고 디버깅에 더 유용한 정보를 포함할 수 있을 것 같습니다. 관련하여 코드에 직접 코멘트를 남겼으니 확인 부탁드립니다.
수고 많으셨습니다!
| BaseErrorCode errorCode = e.getErrorCode(); | ||
|
|
||
| log.warn("GeneralException: {}", errorCode.getMessage()); | ||
| log.warn("GeneralException: {} - {}", errorCode.getMessage(), e.getMessage()); |
There was a problem hiding this comment.
로그 메시지 형식을 개선하면 더 유용할 것 같습니다. 현재 형식은 BusinessException(BaseErrorCode) 생성자를 사용할 때 메시지가 중복으로 로깅될 수 있습니다. (GeneralException: <msg> - <msg>)
e.getMessage()는 BusinessException(String message, BaseErrorCode errorCode) 생성자에서 errorCode.getMessage()를 포함하도록 구성되어 있으므로, 다음과 같이 변경하면 중복을 피하고 에러 코드를 명시적으로 포함하여 디버깅에 더 도움이 될 것입니다.
log.warn("GeneralException: {} (code: {})", e.getMessage(), errorCode.getCode());이렇게 하면 다음과 같이 로깅됩니다.
new BusinessException(errorCode)사용 시:GeneralException: <메시지> (code: <에러코드>)new BusinessException(detail, errorCode)사용 시:GeneralException: <메시지><상세정보> (code: <에러코드>)
| log.warn("GeneralException: {} - {}", errorCode.getMessage(), e.getMessage()); | |
| log.warn("GeneralException: {} (code: {})", e.getMessage(), errorCode.getCode()); |
BusinessException에 문자열만 넘기던 패턴을 도메인별 에러코드로 교체하고, 로깅 개선