fix(updater): handle undefined error when updater not provide error content (#524)

* fix(updater): check updater error is exists or not

* set default error message
This commit is contained in:
Róbert Kiss
2017-12-22 19:50:31 +01:00
committed by László Monda
parent 5d1cc9202b
commit 8bb9f7f839

View File

@@ -37,8 +37,13 @@ export class AppUpdateService extends MainServiceBase {
}); });
autoUpdater.on('error', (ev: any, err: string) => { autoUpdater.on('error', (ev: any, err: string) => {
console.error('[AppUpdateService] error', err); this.logService.error('[AppUpdateService] error', err)
this.sendIpcToWindow(IpcEvents.autoUpdater.autoUpdateError, err.substr(0, 100)); let msg = 'Electron updater error';
if (err) {
msg = err.substr(0, 100);
}
this.sendIpcToWindow(IpcEvents.autoUpdater.autoUpdateError, msg);
}); });
autoUpdater.on('download-progress', (progressObj: ProgressInfo) => { autoUpdater.on('download-progress', (progressObj: ProgressInfo) => {