V16 RC: File upload errors should be shown to the user#19344
Merged
leekelleher merged 1 commit intorelease/16.0from May 19, 2025
Merged
V16 RC: File upload errors should be shown to the user#19344leekelleher merged 1 commit intorelease/16.0from
leekelleher merged 1 commit intorelease/16.0from
Conversation
…sages coming from UmbApiError
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances error handling in UmbTemporaryFileManager by replacing the instanceof check with a static type guard and ensuring all server errors surface a user notification.
- Use
UmbApiError.isUmbApiErrorfor safer type checking. - Add a fallback notification for non-413
UmbApiErrorstatuses.
Comments suppressed due to low confidence (1)
src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts:191
- There are no tests covering the new fallback notification path for non-413
UmbApiErrorstatuses. Consider adding a unit test to verify that#notificationContext.peekis called with the expected error details when an unexpected server error occurs.
if (UmbApiError.isUmbApiError(error)) {
src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts
Show resolved
Hide resolved
leekelleher
approved these changes
May 19, 2025
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.
Description
This pull request refines error handling in the
UmbTemporaryFileManagerclass to improve robustness and user feedback. The key change is the introduction of a more structured check forUmbApiErrorinstances and the addition of a fallback notification mechanism for unhandled server errors.Error handling improvements:
src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts: Replaced a direct instance check ofUmbApiErrorwith a static methodisUmbApiErrorfor better type safety and readability. Added a fallback to display a user notification for unexpected server errors, ensuring all error cases are handled gracefully.