From dcc2ced8ff6b53d7ca445f0923d6c8008f2038de Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:16:51 +0200 Subject: [PATCH] fix: catch any uncaught promises up the chain that could be thrown if there is a fatal error with the request --- .../core/temporary-file/temporary-file-manager.class.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts b/src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts index e89f8979aa..9d756fdb8b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts @@ -61,8 +61,9 @@ export class UmbTemporaryFileManager< for (const item of queue) { if (!item.temporaryUnique) throw new Error(`Unique is missing for item ${item}`); - const { error } = await this.#temporaryFileRepository.upload(item.temporaryUnique, item.file); - //await new Promise((resolve) => setTimeout(resolve, (Math.random() + 0.5) * 1000)); // simulate small delay so that the upload badge is properly shown + const { error } = await this.#temporaryFileRepository + .upload(item.temporaryUnique, item.file) + .catch(() => ({ error: true })); let status: TemporaryFileStatus; if (error) {