Skip to content

fix(desktop): prevent unhandled rejection in cloud status refresh#539

Merged
mrcfps merged 1 commit intomainfrom
fix/sentry-unhandled-rejection-cloud-status
Mar 25, 2026
Merged

fix(desktop): prevent unhandled rejection in cloud status refresh#539
mrcfps merged 1 commit intomainfrom
fix/sentry-unhandled-rejection-cloud-status

Conversation

@nettee
Copy link
Copy Markdown
Contributor

@nettee nettee commented Mar 25, 2026

What

Remove erroneous throw error from refreshCloudStatus that caused unhandled promise rejections when the controller is temporarily unreachable.

Why

Sentry issue NEXU-DESKTOP-PROD-B — 12 occurrences since v0.1.6. Every window focus, tab switch, or 2-second polling cycle during cloud connect produced an unhandled rejection when the controller was down. Closes #535

How

refreshCloudStatus() already handles the error correctly by setting cloudStatusPhase("error") and displaying a user-facing message. The throw error at the end of the catch block is unnecessary — all three callers invoke it fire-and-forget (void refreshCloudStatus(...)), so the re-thrown error has no consumer and surfaces as an unhandled rejection.

Removed the throw error line. No behavior change for the user — the error UI already renders properly without it.

Affected areas

  • Desktop app (Electron shell)

Checklist

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes
  • pnpm generate-types run (if API routes/schemas changed)
  • No credentials or tokens in code or logs
  • No any types introduced (use unknown with narrowing)

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error resilience for cloud profile status. When cloud status retrieval fails, the application now displays an appropriate error message while maintaining stability and responsiveness. Error handling has been improved to prevent error propagation, ensuring the application remains fully functional and users experience no disruptions to other features.

…led rejections

refreshCloudStatus catches controller-unreachable errors and updates UI
state correctly, but then re-throws the error. Since all callers (window
focus, visibility change, polling interval) use fire-and-forget via
`void`, the re-thrown error becomes an unhandled promise rejection
captured by Sentry as NEXU-DESKTOP-PROD-B.

Closes #535
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5480ca35-7342-44ea-9f66-94a84e3aae4d

📥 Commits

Reviewing files that changed from the base of the PR and between 1ef1597 and cf3a017.

📒 Files selected for processing (1)
  • apps/desktop/src/pages/cloud-profile-page.tsx
💤 Files with no reviewable changes (1)
  • apps/desktop/src/pages/cloud-profile-page.tsx

📝 Walkthrough

Walkthrough

The change removes error propagation from the refreshCloudStatus function's error handler in the cloud profile page. Instead of throwing errors from failed cloud status requests, the component now gracefully handles failures by updating the UI state to reflect an error condition.

Changes

Cohort / File(s) Summary
Error Handling
apps/desktop/src/pages/cloud-profile-page.tsx
Removed re-throw in catch block of refreshCloudStatus, allowing the function to handle errors gracefully by updating component state rather than propagating exceptions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • lefarcen

Poem

🐰 A cloud error caught mid-flight,
No longer thrown to cause a fright,
The catch block now holds it tight,
With UI state set just right! ☁️✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preventing unhandled rejection in cloud status refresh by removing an erroneous throw statement.
Description check ✅ Passed The PR description is well-structured, follows the template, and provides clear explanations of what, why, and how. All critical sections are completed with sufficient detail.
Linked Issues check ✅ Passed The PR successfully addresses issue #535 by removing the throw error that caused unhandled promise rejections when the controller is unreachable, fixing the Sentry issue NEXU-DESKTOP-PROD-B.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to removing one line (throw error) from the refreshCloudStatus catch block, staying within the bounds of the linked issue requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sentry-unhandled-rejection-cloud-status

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nettee
Copy link
Copy Markdown
Contributor Author

nettee commented Mar 25, 2026

/cr

@slack-code-review-channel
Copy link
Copy Markdown

✅ CR topic created in Feishu topic group Refly CR.

@mrcfps mrcfps merged commit 7b769b8 into main Mar 25, 2026
7 checks passed
@mrcfps mrcfps deleted the fix/sentry-unhandled-rejection-cloud-status branch March 25, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Error invoking remote method 'host:invoke': TypeError: fetch failed

2 participants