From 289b59074ca46b51f8468cd171fd5b01daddec23 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Mon, 26 Jan 2026 18:58:29 +0200 Subject: [PATCH] refactor: enhance error handling in game queue addition by consolidating promises --- src/main/events/torrenting/add-game-to-queue.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/events/torrenting/add-game-to-queue.ts b/src/main/events/torrenting/add-game-to-queue.ts index ce86f40d..f8115533 100644 --- a/src/main/events/torrenting/add-game-to-queue.ts +++ b/src/main/events/torrenting/add-game-to-queue.ts @@ -56,12 +56,17 @@ const addGameToQueue = async ( const updatedGame = await gamesSublevel.get(gameKey); - await Promise.all([ - createGame(updatedGame).catch(() => {}), + const promises: Promise[] = [ HydraApi.post(`/games/${shop}/${objectId}/download`, null, { needsAuth: false, }).catch(() => {}), - ]); + ]; + + if (updatedGame) { + promises.push(createGame(updatedGame).catch(() => {})); + } + + await Promise.all(promises); return { ok: true }; } catch (err: unknown) {