@@ -98,7 +98,7 @@ import { registerTypes as providersRegisterTypes } from './providers/serviceRegi
9898import { activateSimplePythonRefactorProvider } from './providers/simpleRefactorProvider' ;
9999import { TerminalProvider } from './providers/terminalProvider' ;
100100import { ISortImportsEditingProvider } from './providers/types' ;
101- import { sendErrorTelemetry , sendStartupTelemetry } from './startupTelemetry' ;
101+ import { sendErrorTelemetry , sendStartupTelemetryInBackground } from './startupTelemetry' ;
102102import { registerTypes as commonRegisterTerminalTypes } from './terminals/serviceRegistry' ;
103103import { ICodeExecutionManager , ITerminalAutoActivation } from './terminals/types' ;
104104import { TEST_OUTPUT_CHANNEL } from './testing/common/constants' ;
@@ -118,7 +118,9 @@ export async function activate(context: ExtensionContext): Promise<IExtensionApi
118118 try {
119119 return await activateUnsafe ( context ) ;
120120 } catch ( ex ) {
121- handleError ( ex ) ;
121+ // We want to completely handle the error
122+ // before notifying VS Code.
123+ await handleError ( ex ) ;
122124 throw ex ; // re-raise
123125 }
124126}
@@ -156,9 +158,7 @@ async function activateUnsafe(context: ExtensionContext): Promise<IExtensionApi>
156158 durations . endActivateTime = stopWatch . elapsedTime ;
157159 activationDeferred . resolve ( ) ;
158160
159- sendStartupTelemetry ( activationPromise , durations , stopWatch , serviceContainer )
160- // It will run in the background.
161- . ignoreErrors ( ) ;
161+ sendStartupTelemetryInBackground ( activationPromise , durations , stopWatch , serviceContainer ) ;
162162
163163 return buildApi ( activationPromise , serviceManager , serviceContainer ) ;
164164}
@@ -360,12 +360,12 @@ async function initializeServices(
360360/////////////////////////////
361361// error handling
362362
363- function handleError ( ex : Error ) {
363+ async function handleError ( ex : Error ) {
364364 notifyUser (
365365 "Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information."
366366 ) ;
367367 traceError ( 'extension activation failed' , ex ) ;
368- sendErrorTelemetry ( ex , durations , activatedServiceContainer ) . ignoreErrors ( ) ;
368+ await sendErrorTelemetry ( ex , durations , activatedServiceContainer ) ;
369369}
370370
371371interface IAppShell {
0 commit comments