-
Notifications
You must be signed in to change notification settings - Fork 1
chore: 날짜 파싱 로직 안정성 개선 완료 #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary by CodeRabbit릴리스 노트
✏️ Tip: You can customize this high-level summary in your review settings. 요약Slack 및 Discord 알림 서비스에서 ISO 형식 날짜 파싱 로직에 Null 안전성과 예외 처리를 추가했습니다. 파싱 실패 시 경고를 기록하고 원본 값 또는 "Unknown Date"를 반환하여 알림 전송이 중단되지 않도록 개선했습니다. 변경사항
예상 코드 리뷰 소요 시간🎯 2 (Simple) | ⏱️ ~10분 시 (시로부터)
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/org/sopt/makers/service/SlackNotificationService.java (1)
54-58: 도달 불가능한 예외 처리 블록을 정리하는 것을 고려하세요.
formatDateTime메서드가 이제DateTimeException을 내부에서 처리하므로, 이 catch 블록은 날짜 파싱 오류로 인해 실행될 수 없습니다.buildSlackMessage내에 다른 날짜/시간 연산이 없다면, 이 예외 처리는 도달 불가능한 코드입니다.🔎 선택적 리팩토링 제안
- private SlackMessage createSlackMessage(String team, String type, String stage, - SentryEventDetail sentryEventDetail) throws SentryCheckedException { - try { - return buildSlackMessage(team, type, stage, sentryEventDetail); - } catch (DateTimeException e) { - log.error("Slack 메시지 생성 실패: team={}, type={}, stage={}, id={}, error={}", team, type, stage, - sentryEventDetail.issueId(), e.getMessage(), e); - throw MessageBuildException.from(ErrorMessage.SLACK_MESSAGE_BUILD_FAILED); - } - } + private SlackMessage createSlackMessage(String team, String type, String stage, + SentryEventDetail sentryEventDetail) { + return buildSlackMessage(team, type, stage, sentryEventDetail); + }또는 향후 다른 날짜 연산을 위한 방어적 코드로 유지하려는 의도라면, 주석으로 명시하는 것이 좋습니다.
src/main/java/org/sopt/makers/service/DiscordNotificationService.java (1)
51-55: 도달 불가능한 예외 처리 블록을 정리하는 것을 고려하세요.
formatDateTime메서드가 이제DateTimeException을 내부에서 처리하므로, 이 catch 블록은 날짜 파싱 오류로 인해 실행될 수 없습니다.buildDiscordMessage내에 다른 날짜/시간 연산이 없다면, 이 예외 처리는 도달 불가능한 코드입니다.🔎 선택적 리팩토링 제안
- private DiscordMessage createDiscordMessage(String team, String type, String stage, - SentryEventDetail sentryEventDetail) throws SentryCheckedException { - try { - return buildDiscordMessage(team, type, stage, sentryEventDetail); - } catch (DateTimeException e) { - log.error("Discord 메시지 생성 실패: team={}, type={}, stage={}, id={}, error={}", team, type, stage, - sentryEventDetail.issueId(), e.getMessage(), e); - throw MessageBuildException.from(ErrorMessage.DISCORD_MESSAGE_BUILD_FAILED); - } - } + private DiscordMessage createDiscordMessage(String team, String type, String stage, + SentryEventDetail sentryEventDetail) { + return buildDiscordMessage(team, type, stage, sentryEventDetail); + }또는 향후 다른 날짜 연산을 위한 방어적 코드로 유지하려는 의도라면, 주석으로 명시하는 것이 좋습니다.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/org/sopt/makers/service/DiscordNotificationService.javasrc/main/java/org/sopt/makers/service/SlackNotificationService.java
🔇 Additional comments (2)
src/main/java/org/sopt/makers/service/SlackNotificationService.java (1)
158-171: 날짜 파싱 안정성 개선이 잘 구현되었습니다.null 체크와 예외 처리 로직이 정확하게 구현되어 있으며, PR 목표를 완벽하게 충족합니다:
- Early return 패턴으로 가독성 향상
DateTimeException발생 시 원본 값을 반환하여 정보 손실 방지- 적절한 로그 레벨(warn)로 디버깅 가능성 확보
- 알림 전송 트랜잭션 중단 방지
src/main/java/org/sopt/makers/service/DiscordNotificationService.java (1)
183-196: SlackNotificationService와 일관된 안정성 개선이 잘 구현되었습니다.두 알림 서비스 간 동일한 오류 처리 패턴을 적용하여 유지보수성이 향상되었습니다. 구현이 정확하며 PR 목표를 충족합니다.
Related issue 🛠
Work Description ✏️
datetime필드가null이거나 비표준 형식이어서 파싱에 실패할 경우, 알림 전송이 중단되지 않고 원문(rawValue)이나 "Unknown Date"로 처리되도록 개선했습니다.null체크에 Early Return 패턴을 적용하여 코드 가독성을 높였습니다.Trouble Shooting ⚽️
DateTimeException이 발생하면 알림 전송 트랜잭션 전체가 롤백/실패 처리되어, 정작 중요한 에러 정보를 받아보지 못할 위험이 있었습니다. 이를 Fallback 로직으로 감싸 해결했습니다.