@@ -8,7 +8,7 @@ import * as path from 'path';
88import { version } from '../../package.json' ;
99import { isMac , isWindowsOS } from '../common/env' ;
1010import { logger } from '../common/logger' ;
11- import { isUrl } from '../common/utils' ;
11+ import { formatError , isUrl } from '../common/utils' ;
1212import { whitelistHandler } from '../common/whitelist-handler' ;
1313import { fetchLatestVersion } from './auto-update-utils' ;
1414import { sendAutoUpdateAnalytics } from './bi/auto-update-analytics' ;
@@ -107,8 +107,8 @@ export class AutoUpdate {
107107 this . autoUpdater . on ( 'error' , ( error ) => {
108108 this . autoUpdateTrigger = undefined ;
109109 logger . error (
110- 'auto-update-handler: Error occurred while updating. ' ,
111- error ,
110+ 'auto-update-handler: Error occurred while updating.' ,
111+ formatError ( error ) ,
112112 ) ;
113113 } ) ;
114114 await this . performForcedAutoUpdate ( ) ;
@@ -217,13 +217,21 @@ export class AutoUpdate {
217217 ) : Promise < void > => {
218218 this . autoUpdateTrigger = trigger ;
219219 logger . info ( 'auto-update-handler: Checking for updates' , trigger ) ;
220- if ( this . autoUpdater ) {
221- const opts : GenericServerOptions = await this . getGenericServerOptions ( ) ;
222- this . autoUpdater . setFeedURL ( opts ) ;
223- const updateCheckResult = await this . autoUpdater . checkForUpdates ( ) ;
224- logger . info ( 'auto-update-handler: ' , updateCheckResult ) ;
220+ try {
221+ if ( this . autoUpdater ) {
222+ const opts : GenericServerOptions = await this . getGenericServerOptions ( ) ;
223+ this . autoUpdater . setFeedURL ( opts ) ;
224+ const updateCheckResult = await this . autoUpdater . checkForUpdates ( ) ;
225+ logger . info ( 'auto-update-handler: ' , updateCheckResult ) ;
226+ }
227+ } catch ( error ) {
228+ logger . error (
229+ 'auto-update-handler: Error occurred while checking for updates' ,
230+ formatError ( error ) ,
231+ ) ;
232+ } finally {
233+ logger . info ( 'auto-update-handler: After checking auto update' ) ;
225234 }
226- logger . info ( 'auto-update-handler: After checking auto update' ) ;
227235 } ;
228236
229237 /**
@@ -416,7 +424,10 @@ export class AutoUpdate {
416424 this . channelConfigLocation = ChannelConfigLocation . REGISTRY ;
417425 }
418426 } catch ( error ) {
419- logger . error ( 'auto-update-handler: error retrieving registry' , error ) ;
427+ logger . error (
428+ 'auto-update-handler: error retrieving registry' ,
429+ formatError ( error ) ,
430+ ) ;
420431 }
421432 }
422433 } ;
0 commit comments