@@ -233,18 +233,36 @@ export async function runHTK(options: {
233233 updateMutex . runExclusive ( ( ) =>
234234 ( < Promise < void > > updateCommand . run ( [ 'stable' ] ) )
235235 . catch ( ( error ) => {
236- // Received successful update that wants to restart the server
237- if ( isErrorLike ( error ) && error . code === 'EEXIT' ) {
238- // Block future update checks for one hour.
239-
240- // If we don't, we'll redownload the same update again every check.
241- // We don't want to block it completely though, in case this server
242- // stays open for a very long time.
243- return delay ( 1000 * 60 * 60 ) ;
236+ if ( isErrorLike ( error ) ) {
237+ // Did we receive a successful update, that wants to restart the server:
238+ if ( error . code === 'EEXIT' ) {
239+ // Block future update checks for one hour.
240+
241+ // If we don't, we'll redownload the same update again every check.
242+ // We don't want to block it completely though, in case this server
243+ // stays open for a very long time.
244+ return delay ( 1000 * 60 * 60 ) ;
245+ }
246+
247+ // Report any HTTP response errors cleanly & explicitly:
248+ if ( error . statusCode ) {
249+ let url : string | undefined ;
250+ if ( 'http' in error ) {
251+ const request = ( error as any ) . http ?. request ;
252+ url = `${ request ?. protocol } //${ request ?. host } ${ request ?. path } `
253+ }
254+
255+ logError ( `Failed to check for updates due to ${ error . statusCode } response ${
256+ url
257+ ? `from ${ url } `
258+ : 'from unknown URL'
259+ } `) ;
260+ return ;
261+ }
244262 }
245263
246- console . log ( error ) ;
247- logError ( ' Failed to check for updates' ) ;
264+ console . log ( error . message ) ;
265+ logError ( ` Failed to check for updates: ${ error . message } ` ) ;
248266 } )
249267 ) ;
250268 } ) ;
0 commit comments