Skip to content

Commit

Permalink
fix(electron-updater): make "checkForUpdatesAndNotify" catchable prom…
Browse files Browse the repository at this point in the history
…ise (#3531)

* so library consumers could catch the promise rejection as currently it's only possible to catch in global "process.on('unhandledRejection', ..." handler
  • Loading branch information
vladimiry authored and develar committed Dec 19, 2018
1 parent 930dc8d commit 2c674df
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/electron-updater/src/AppUpdater.ts
Expand Up @@ -246,16 +246,15 @@ export abstract class AppUpdater extends EventEmitter {
return Promise.resolve(null)
}

const checkForUpdatesPromise = this.checkForUpdates()
checkForUpdatesPromise
return this.checkForUpdates()
.then(it => {
const downloadPromise = it.downloadPromise
if (downloadPromise == null) {
const debug = this._logger.debug
if (debug != null) {
debug("checkForUpdatesAndNotify called, downloadPromise is null")
}
return
return it
}

downloadPromise
Expand All @@ -265,9 +264,9 @@ export abstract class AppUpdater extends EventEmitter {
body: `${this.app.name} version ${it.updateInfo.version} has been downloaded and will be automatically installed on exit`
}).show()
})
})

return checkForUpdatesPromise
return it
})
}

private async isStagingMatch(updateInfo: UpdateInfo): Promise<boolean> {
Expand Down

0 comments on commit 2c674df

Please sign in to comment.