[Feat/#216] 엑셀 분석 실패 시 ErrorNotifier로 에러 알림 전파 - #217
Conversation
📝 Walkthrough엑셀 상품 분석 작업 실패 시 Discord/Sentry 알림이 전파되도록 모니터링 및 import job 워커 로직을 변경했습니다.
WalkthroughChanges오류 알림 전파
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ImportJobProcessor
participant ErrorNotificationDispatcher
participant Discord
participant Sentry
ImportJobProcessor->>ErrorNotificationDispatcher: dispatchJob(exception, jobId)
ErrorNotificationDispatcher->>ErrorNotificationDispatcher: ErrorContext 생성 후 dispatch 위임
ErrorNotificationDispatcher->>Discord: 오류 알림 발송
ErrorNotificationDispatcher->>Sentry: 오류 알림 발송
🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt (1)
80-92: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win코루틴 취소 시 발생하는
CancellationException예외 처리 추가현재 코루틴 환경에서
Exception을 포괄적으로 잡고 있어CancellationException도 함께 잡히게 됩니다. 이 경우 코루틴의 정상적인 취소 흐름(예: 애플리케이션 종료, 부모 코루틴 취소)이 깨지게 되며, 특히 이번 PR에서 추가된dispatchJob호출로 인해 정상적인 코루틴 취소가 엑셀 분석 실패 에러 알람으로 오발송되는 치명적인 부작용이 발생합니다.As per coding guidelines, 인접 코드 개선이나 리팩토링을 임의로 하지 않아야 하지만, 새로 추가된 알림 로직의 오작동(False Alarm) 및 불필요한 스팸 발송을 막기 위해
CancellationException은 무시하고 다시 던지도록 예외 처리를 추가하는 것이 필수적입니다.🐛 제안하는 예외 처리 수정안
- } catch (e: Exception) { + } catch (e: Exception) { + if (e is CancellationException) throw e logger.error(e) { "엑셀 분석 실패: jobId=${job.jobId}" } if (importJobFinisher.fail(job.jobId, ImportJobErrorCode.ANALYSIS_FAILED.name)) { importJobEventChannel.publish(🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt` around lines 80 - 92, Update the exception handling around the Excel analysis in ImportJobProcessor so CancellationException is caught separately, rethrown immediately, and does not invoke fail, publish, or dispatchJob. Keep the existing Exception handling for actual analysis failures unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt`:
- Around line 80-92: Update the exception handling around the Excel analysis in
ImportJobProcessor so CancellationException is caught separately, rethrown
immediately, and does not invoke fail, publish, or dispatchJob. Keep the
existing Exception handling for actual analysis failures unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7608a5a1-bc3e-4995-8028-73ec48221b43
📒 Files selected for processing (3)
api/core-api/src/main/kotlin/kr/dongchimi/api/core/common/exception/GlobalExceptionHandler.ktcore/src/main/kotlin/kr/dongchimi/core/monitoring/ErrorNotificationDispatcher.ktcore/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt
#️⃣연관된 이슈
📝작업 내용
ErrorNotificationDispatcher를api:core-api→core/monitoring으로 이동ErrorNotifier/ErrorContext가 있는 core/monitoring이 자연스러운 위치ImportJobProcessor)는 core에 있어 기존 위치(api:core-api)로는 접근 불가했음dispatchJob(throwable, jobId)추가 — HTTP 전용 필드는 null, jobId는requestBody에jobId=...형태로 담아 전달ImportJobProcessor엑셀 분석 실패 catch 블록에서dispatchJob호출 → Discord/Sentry로 알림 전파스크린샷 (선택)
💬리뷰 요구사항(선택)
importJobFinisher.fail()성공 여부와 무관하게 무조건 발송됩니다 (예외가 실제 발생했으므로). 실패 확정 시에만 알림이 필요하다면 의견 주세요.