Suggestion: Add FileSaveCancelledException or IsCancelled property to FileSaverResult for clean cancellation handling #2668
RaresOP
started this conversation in
New Feature Discussions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
One issue I've encountered while working with
FileSaver.SaveAsync(...)
is handling user-initiated cancellations. Currently, if the user cancels the save dialog, the returned FileSaverResult simply contains a generic Exception, and we have to inspect the exception message (e.g., looking for "Operation cancelled") to detect this scenario. This is brittle and not very clean.I’d like to suggest one or both of the following enhancements:
FileSaveCancelledException
that can be caught explicitly.IsCancelled
boolean property to the FileSaverResult type.Example:
This would allow developers to distinguish between:
Happy to submit a PR if this change sounds acceptable.
Beta Was this translation helpful? Give feedback.
All reactions