Skip to content

Commit

Permalink
Merge pull request #27 from gov4git/catch-update-errors
Browse files Browse the repository at this point in the history
Catch app update errors
  • Loading branch information
dworthen authored Oct 26, 2023
2 parents d50d013 + 2bb1dfc commit 2cb8fc3
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) => {
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 2cb8fc3

Please sign in to comment.