Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch app update errors #27

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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
Loading