Skip to content

Commit e8fce41

Browse files
committed
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
1 parent c316d5b commit e8fce41

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/backend/logger/logger.ts

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export function initLogger() {
7676
forceLog: true
7777
})
7878
})
79+
.catch((error) =>
80+
logError(['Failed to fetch system information', error], LogPrefix.Backend)
81+
)
7982

8083
logInfo(['Legendary location:', join(...Object.values(getLegendaryBin()))], {
8184
prefix: LogPrefix.Legendary,

src/backend/main.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,15 @@ ipcMain.handle(
978978

979979
const logFileLocation = getLogFileLocation(appName)
980980

981-
const systemInfo = await getSystemInfo().then(formatSystemInfo)
981+
const systemInfo = await getSystemInfo()
982+
.then(formatSystemInfo)
983+
.catch((error) => {
984+
logError(
985+
['Failed to fetch system information', error],
986+
LogPrefix.Backend
987+
)
988+
return 'Error, check general log'
989+
})
982990
writeFileSync(logFileLocation, 'System Info:\n' + `${systemInfo}\n` + '\n')
983991

984992
const gameSettingsString = JSON.stringify(gameSettings, null, '\t')

0 commit comments

Comments
 (0)