Skip to content

Commit

Permalink
Catch getSystemInfo-related errors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
CommandMC committed Sep 23, 2023
1 parent d5eac45 commit 9e7568a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/backend/logger/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 9 additions & 1 deletion src/backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 9e7568a

Please sign in to comment.