Discarding changes displays error #13899
Merged
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.
Partially addresses #13888
Description
An issue reported in 2.9.7 which is a result of the Electron upgrade is that discarding changes may now fail if the user has their recycling bin set to "Don't move files to the Recycle Bin. Remove files immediately when deleted". It is a bad failure case in that the application just hangs and must be force quitted. This PR captures the error thrown my the electron
shell.trashItem()
method and informs the user of the failure.I marked this as partially addressing #13888. This is because in prior versions of Desktop on an Electron version prior to 13, the trashItem method did not error and simply did not move the files to the Recycle Bin (silently failing). This a bug because we expected the files to be moved to the recycle bin and we inform users of this on the discard pop up. However, to only display error here feels like a regression as we are preventing users from discarding changes when they used to be able to.
Screenshots
Release notes
Notes: [Fixed] App does not hang when discarding changes in some scenarios.