From 9e7568af7b91bf7f6fd87abfcbfaee42ad69bfcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathis=20Dr=C3=B6ge?= Date: Sat, 23 Sep 2023 19:51:44 +0200 Subject: [PATCH] Catch `getSystemInfo`-related errors When initializing Heroic's general / the game's log, we don't *have to* get system information for anything else to work; we can just report that there was an error & carry on --- src/backend/logger/logger.ts | 3 +++ src/backend/main.ts | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/backend/logger/logger.ts b/src/backend/logger/logger.ts index fee4455bc4..477cc56a0a 100644 --- a/src/backend/logger/logger.ts +++ b/src/backend/logger/logger.ts @@ -76,6 +76,9 @@ export function initLogger() { forceLog: true }) }) + .catch((error) => + logError(['Failed to fetch system information', error], LogPrefix.Backend) + ) logInfo(['Legendary location:', join(...Object.values(getLegendaryBin()))], { prefix: LogPrefix.Legendary, diff --git a/src/backend/main.ts b/src/backend/main.ts index bb73abb2e1..39e37a492f 100644 --- a/src/backend/main.ts +++ b/src/backend/main.ts @@ -978,7 +978,15 @@ ipcMain.handle( const logFileLocation = getLogFileLocation(appName) - const systemInfo = await getSystemInfo().then(formatSystemInfo) + const systemInfo = await getSystemInfo() + .then(formatSystemInfo) + .catch((error) => { + logError( + ['Failed to fetch system information', error], + LogPrefix.Backend + ) + return 'Error, check general log' + }) writeFileSync(logFileLocation, 'System Info:\n' + `${systemInfo}\n` + '\n') const gameSettingsString = JSON.stringify(gameSettings, null, '\t')