Stop a navigation failure from surfacing after undo/redo is applied - #100
Merged
Merged
Conversation
…ied [patch] UndoAsync, RedoAsync and UndoToSaveBoundaryAsync applied the change, moved the position and raised the event before navigating, but only caught OperationCanceledException from the navigation provider. Any other provider exception reached the caller after the undo had succeeded, so a caller following the #75 contract would retry and undo a second command. The three call sites now share NavigateSafelyAsync, which treats every navigation failure as non-critical, as it already did for timeouts. Fixes #89 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TX4nouJvSXNs7eSvDP13qU
|
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.



Fixes #89
What was wrong
UndoAsync,RedoAsyncandUndoToSaveBoundaryAsyncapply the change, move the position and raise the event, and only then navigate. Around that navigation call they caught onlyOperationCanceledException. If the navigation provider threw anything else, such as anInvalidOperationExceptionbecause the editor was closed, the exception reached the caller even though the undo had already happened. Under the #75 contract, a caller that sees an exception assumes the stack did not move. It would retry and undo a second command.Change
NavigateSafelyAsync. It keeps the existing checks (EnableNavigation, a provider is set, the context is non-empty) and the linked timeout.IUndoRedoService.Tests
UndoAsync,RedoAsyncandUndoToSaveBoundaryAsync. Each uses a navigation provider that throws, and checks the return value, the command's effect and the resulting position.🤖 Generated with Claude Code
https://claude.ai/code/session_01TX4nouJvSXNs7eSvDP13qU
Generated by Claude Code