Skip to content

Commit d10ba42

Browse files
authored
V16.1: 400 errors are being wrongfully ignored (#19648)
fix: allows 400 errors to have a default notification unless silenced manually by `disableNotifications`
1 parent dcd8b42 commit d10ba42

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/resources/try-execute/try-execute.controller.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ import type { UmbApiResponse, UmbTryExecuteOptions } from '../types.js';
33
import { UmbCancelError } from '../umb-error.js';
44
import type { UmbApiError } from '../umb-error.js';
55

6+
/**
7+
* Codes that are ignored for notifications.
8+
* These are typically non-fatal errors that the UI can handle gracefully,
9+
* such as 401 (Unauthorized), 403 (Forbidden), and 404 (Not Found).
10+
* The UI should handle these cases without showing a notification.
11+
*/
12+
const IGNORED_ERROR_CODES = [401, 403, 404];
13+
614
export class UmbTryExecuteController<T> extends UmbResourceController<T> {
715
#abortSignal?: AbortSignal;
816

@@ -49,7 +57,7 @@ export class UmbTryExecuteController<T> extends UmbResourceController<T> {
4957

5058
// Check if we can extract problem details from the error
5159
if (apiError.problemDetails) {
52-
if ([400, 401, 403, 404].includes(apiError.problemDetails.status)) {
60+
if (IGNORED_ERROR_CODES.includes(apiError.problemDetails.status)) {
5361
// Non-fatal errors that the UI can handle gracefully
5462
// so we avoid showing a notification
5563
return;

0 commit comments

Comments
 (0)