fix: Ignore network failures when cancelling background alerts - #13
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
do0ori
added a commit
that referenced
this pull request
Sep 4, 2026
…k-errors fix: Ignore network failures when cancelling background alerts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
프로덕션 Sentry에
TypeError: Failed to fetch가mechanism: onunhandledrejection으로 올라온다. breadcrumb은[error] fetch: DELETE https://visual-timer-notifications.do0ori.workers.dev/v1/schedules/default를 가리킨다.원인
cancelTimerNotification은fetch를await만 하고 예외를 처리하지 않는데,useTimer의 호출 지점 6곳이 전부void cancelTimerNotification(timer.id)형태의 fire-and-forget이다. 같은 파일의scheduleTimerNotification과clearRunningStatus에는 호출부에.catch()가 붙어 있으나 cancel 경로만 빠져 있었다.그 결과 오프라인이거나 페이지가 백그라운드로 내려간 상태에서 요청이 실패하면 그대로 unhandled rejection이 된다. 리포트의 breadcrumb에 남은
Document is hidden on mount/handleVisibilityChange가 이 상황과 일치한다. 취소 동작 자체는 로컬에서 이미 끝나 있어 사용자에게 보이는 영향은 없고 Sentry 노이즈만 발생한다.수정
호출부 6곳에
.catch()를 다는 대신cancelTimerNotification자체에서 처리했다. 앞으로 추가될 호출부에서 또 빠뜨릴 여지를 없애기 위해서다.실패 시 저장된 credentials는 지우지 않고 남긴다.
createScheduleCredentials는 저장된 값이 없으면 capability 토큰을 새로 발급하므로, 여기서 지우면 서버에 남아 있는 스케줄을 나중에 삭제할 수단이 사라진다.검증
먼저 실패하는 테스트로 오류를 재현한 뒤 수정했다.
TypeError: Failed to fetch로 실패할 때 reject하지 않고 credentials를 보존하는 테스트npm test32 passed,tsc --noEmit과npm run build모두 정상.🤖 Generated with Claude Code