Electron-builder: Error dialog popup if new version download interrupted

Created on 14 Dec 2017  路  4Comments  路  Source: electron-userland/electron-builder

  • Version:

    • Currently in production: 19.27.3 and electron-updater 2.9.3. Electron 1.6.15.
    • Currently in beta: 19.29.2 and electron-updater 2.16.1. Electron 1.7.9.
    • Tested locally: 19.49.2 and electron-updater 2.17.6. Electron 1.7.9.
  • Target: Mac, Windows, Linux

screen shot 2017-12-14 at 10 20 11 am

If a new version is downloading when the internet connection is cut off, Electron pops up a dialog like the screenshot. This is despite the fact that we're registering for the 'error' event: https://github.com/WhisperSystems/Signal-Desktop/blob/6f2260d08c57ae53dee356991da404d096777d5e/app/auto_update.js#L72

I did some testing locally, also listening for any promise rejection from a checkForUpdates() call, but it didn't make a difference:

autoUpdater.checkForUpdates().then(function() {
  console.log('Check for updates is complete');
}, onError);

I also noticed that if I left the error dialog up a long time, I got an interesting couple stack traces. First, while the dialog is up, I got this:

Got an error while updating:  Error: The request timed out.
    at Object.showErrorBox (/signal/electron/dist/mac/Signal Beta.app/Contents/Resources/electron.asar/browser/api/dialog.js:283:20)
    at process.<anonymous> (/signal/electron/dist/mac/Signal Beta.app/Contents/Resources/electron.asar/browser/init.js:57:10)
    at emitOne (events.js:96:13)
    at process.emit (events.js:191:7)
    at process.emit (/signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/source-map-support/source-map-support.js:439:21)
    at process._fatalException (bootstrap_node.js:308:26)

Then, after that, when I clicked 'OK', got these stack traces:

Got an error while updating:  Error: The request timed out.
    at Object.showErrorBox (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/electron.asar/browser/api/dialog.js:283:20)
    at process.<anonymous> (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/electron.asar/browser/init.js:57:10)
    at emitOne (events.js:96:13)
    at process.emit (events.js:191:7)
    at process.emit (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/source-map-support/source-map-support.js:439:21)
    at process._fatalException (bootstrap_node.js:308:26)
    From previous event:
    at signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/src/MacUpdater.ts:44:12
    From previous event:
    at MacUpdater.doDownloadUpdate (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/out/MacUpdater.js:127:11)
    at signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:331:25
    at Generator.next (<anonymous>)
    From previous event:
    at MacUpdater.downloadUpdate (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:366:11)
    at signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:307:49
    From previous event:
    at MacUpdater.doCheckForUpdates (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:337:11)
    at signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:255:25
    at Generator.next (<anonymous>)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
    From previous event:
    at MacUpdater._checkForUpdates (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/out/AppUpdater.js:291:11)
    at MacUpdater.checkForUpdates (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/node_modules/electron-updater/src/AppUpdater.ts:204:35)
    at checkForUpdates (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/app/auto_update.js:18:15)
    at Object.initialize (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/app/auto_update.js:76:3)
    at App.<anonymous> (signal/electron/dist/mac/Signal Beta.app/Contents/Resources/app.asar/main.js:378:14)
    at emitTwo (events.js:111:20)
    at App.emit (events.js:194:7)

And finally that same stack trace is logged out by Node.js as an 'Unhandled rejection'. Given that I'm listening for errors coming back from checkForUpdates() this is definitely something the library needs to change. I'm listening for rejected promises.

The original issue as reported by our users: https://github.com/WhisperSystems/Signal-Desktop/issues/1861

bug electron-updater

Most helpful comment

+1, this is essential. The program should be able to catch all errors.

All 4 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I still get this issue, it'd be great if we could catch the error.

I'm having similar issue with this. is there any updates?

"electron-updater": "^4.1.2",
"electron-builder": "^21.2.0",
"electron": "^6.0.4"

if there is a way to catch the error and restart the download process that would be ideal

+1, this is essential. The program should be able to catch all errors.

Was this page helpful?
0 / 5 - 0 ratings