fix: handle session not found errors without crashing the renderer#32085
Open
SisyphusZheng wants to merge 2 commits into
Open
fix: handle session not found errors without crashing the renderer#32085SisyphusZheng wants to merge 2 commits into
SisyphusZheng wants to merge 2 commits into
Conversation
When a session is deleted server-side while a user is viewing it, the throwOnError client config causes 404 errors to be thrown by the SDK. The catch handlers in directory-sync.ts were re-throwing these for tracked sessions (the ones the user is actively viewing), which propagated as unhandled promise rejections through the sync pipeline and crashed the renderer. Now 404 errors are always swallowed regardless of tracking state.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #25131
Type of change
What does this PR do?
When Desktop restores or syncs a session ID that no longer exists on the active server, the SDK throws a 404 because the client is configured with
throwOnError: true.directory-sync.tsalready handled 404s for untracked sessions, but it re-threw the same 404 for tracked sessions. That made a missing active/restored session bubble through the sync pipeline as an unhandled rejection and crash the renderer.This PR changes the two session sync catch handlers to swallow
NotFoundError/404 responses for tracked sessions too. A deleted or stale session should no longer crash the renderer while the surrounding sync state catches up.How did you verify your code works?
Checked the affected sync path locally and confirmed the PR diff only changes the two
isNotFound(error)handlers inpackages/app/src/context/directory-sync.ts.Screenshots / recordings
Not applicable. This is an error handling change.
Checklist