Skip to content

Commit

Permalink
Catch app update errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dworthen committed Oct 26, 2023
1 parent d50d013 commit 2bb1dfc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-waves-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gov4git-desktop-app': patch
---

Catch app update errors
23 changes: 14 additions & 9 deletions src/electron/services/AppUpdaterService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,24 @@ export class AppUpdaterService extends AbstractAppUpdaterService {

public override checkForUpdates = async (): Promise<AppUpdateInfo | null> => {
if (this.updating != null) return this.updating
const updateInfo = await autoUpdater.checkForUpdates()
if (updateInfo == null) return null
if (updateInfo.downloadPromise != null) {
this.updating = updateInfo.downloadPromise.then((r) => {
try {
const updateInfo = await autoUpdater.checkForUpdates()
if (updateInfo == null) return null
if (updateInfo.downloadPromise != null) {
this.updating = updateInfo.downloadPromise.then((r) => {

Check warning on line 65 in src/electron/services/AppUpdaterService.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, release/linux-unpacked)

'r' is defined but never used

Check warning on line 65 in src/electron/services/AppUpdaterService.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest, release/mac)

'r' is defined but never used

Check warning on line 65 in src/electron/services/AppUpdaterService.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, release/win-upacked)

'r' is defined but never used
return {
ready: true,
version: updateInfo.updateInfo.version,
}
})
return {
ready: true,
ready: false,
version: updateInfo.updateInfo.version,
}
})
return {
ready: false,
version: updateInfo.updateInfo.version,
}
} catch (ex) {
this.log.error(`Error checking for updates`)
this.log.error(ex)
}
return null
}
Expand Down

0 comments on commit 2bb1dfc

Please sign in to comment.