@@ -22,33 +22,38 @@ module.exports = {
2222 start ( app , interval ) {
2323 log . info ( "starting auto-updater" )
2424 const platform = os . platform ( ) + "_" + os . arch ( )
25- autoUpdater . setFeedURL ( `${ UPDATES_SERVER_URL } /update/${ platform } /${ app . getVersion ( ) } ` )
2625
27- // Fire callbacks on events for notification purposes
28- autoUpdater . on ( "error" , ( err ) => {
29- log . error ( err )
30- } )
26+ try {
27+ autoUpdater . setFeedURL ( `${ UPDATES_SERVER_URL } /update/${ platform } /${ app . getVersion ( ) } ` )
3128
32- autoUpdater . on ( "update-downloaded" , ( releaseNotes , releaseName ) => {
33- log . info ( "Application update downloaded" )
29+ // Fire callbacks on events for notification purposes
30+ autoUpdater . on ( "error" , ( err ) => {
31+ log . error ( err )
32+ } )
33+
34+ autoUpdater . on ( "update-downloaded" , ( releaseNotes , releaseName ) => {
35+ log . info ( "Application update downloaded" )
3436
35- const updateDialogOpts = {
36- type : "info" ,
37- buttons : [ "Restart" , "Later" ] ,
38- title : "Application Update" ,
39- message : "An update for this Classroom Assistant has been downloaded. Please restart the application to apply the updates."
40- }
37+ const updateDialogOpts = {
38+ type : "info" ,
39+ buttons : [ "Restart" , "Later" ] ,
40+ title : "Application Update" ,
41+ message : "An update for this Classroom Assistant has been downloaded. Please restart the application to apply the updates."
42+ }
4143
42- dialog . showMessageBox ( updateDialogOpts , ( response ) => {
43- if ( response === 0 ) autoUpdater . quitAndInstall ( )
44+ dialog . showMessageBox ( updateDialogOpts , ( response ) => {
45+ if ( response === 0 ) autoUpdater . quitAndInstall ( )
46+ } )
4447 } )
45- } )
4648
47- log . info ( "checking for updates.." )
48- autoUpdater . checkForUpdates ( )
49- setInterval ( ( ) => {
5049 log . info ( "checking for updates.." )
5150 autoUpdater . checkForUpdates ( )
52- } , interval )
51+ setInterval ( ( ) => {
52+ log . info ( "checking for updates.." )
53+ autoUpdater . checkForUpdates ( )
54+ } , interval )
55+ } catch ( err ) {
56+ log . warn ( `Failed to initialize updater ${ err } ` )
57+ }
5358 }
5459}
0 commit comments