fix: handle unhandled promise rejections in auto-updater#3296
fix: handle unhandled promise rejections in auto-updater#3296jeanfbrito wants to merge 1 commit intodevfrom
Conversation
The user-initiated update check wrapped checkForUpdates() inside setTimeout without awaiting the returned promise, causing unhandled rejections when the GitHub releases feed is unreachable. Similarly, downloadUpdate() was not awaited. Both now properly await their promises so the existing try-catch blocks can catch errors.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📓 Common learnings🔇 Additional comments (2)
WalkthroughThis change modifies the update initialization and download flows in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Summary
ERR_UPDATER_NO_PUBLISHED_VERSIONS) that crashes the app when the GitHub releases feed is unreachable for some usersawaitthecheckForUpdates()promise in user-initiated checks — it was previously fire-and-forget inside asetTimeoutcallback, escaping the try-catchawaitthedownloadUpdate()promise so its try-catch also worksContext
Some users report an unhandled promise rejection when checking for updates. The same version works for others — the releases exist on GitHub, but the affected machines can't reach the Atom feed (likely network/proxy/rate-limiting). The startup check (
await autoUpdater.checkForUpdates()) handled this correctly, but the user-initiated check and download path did not.Test plan
npx tsc --noEmitpassesyarn lintpassesyarn test— 213/213 tests passSummary by CodeRabbit
Bug Fixes