@@ -27,21 +27,25 @@ import { TelemetryService } from './api/telemetry-service';
2727import { Logger } from './logger' ;
2828
2929export async function activate ( _extensionContext : vscode . ExtensionContext ) : Promise < Api > {
30- const [
31- { K8sDevfileServiceImpl } ,
32- { K8SServiceImpl } ,
33- { K8sDevWorkspaceEnvVariables } ,
34- { K8sWorkspaceServiceImpl } ,
35- { GithubServiceImpl } ,
36- { K8sTelemetryServiceImpl } ,
37- ] = await Promise . all ( [
38- import ( './impl/k8s-devfile-service-impl' ) ,
39- import ( './impl/k8s-service-impl' ) ,
40- import ( './impl/k8s-devworkspace-env-variables' ) ,
41- import ( './impl/k8s-workspace-service-impl' ) ,
42- import ( './impl/github-service-impl' ) ,
43- import ( './impl/k8s-telemetry-service-impl' ) ,
44- ] ) ;
30+ const importWithDiagnostics = async < T > ( label : string , loader : ( ) => Promise < T > ) : Promise < T > => {
31+ console . error ( `[pending-migration][che-api] import:start ${ label } ` ) ;
32+ try {
33+ const loadedModule = await loader ( ) ;
34+ console . error ( `[pending-migration][che-api] import:ok ${ label } ` ) ;
35+ return loadedModule ;
36+ } catch ( error ) {
37+ const message = error instanceof Error ? error . stack ?? error . message : String ( error ) ;
38+ console . error ( `[pending-migration][che-api] import:fail ${ label } \n${ message } ` ) ;
39+ throw error ;
40+ }
41+ } ;
42+
43+ const { K8sDevfileServiceImpl } = await importWithDiagnostics ( 'k8s-devfile-service-impl' , ( ) => import ( './impl/k8s-devfile-service-impl' ) ) ;
44+ const { K8SServiceImpl } = await importWithDiagnostics ( 'k8s-service-impl' , ( ) => import ( './impl/k8s-service-impl' ) ) ;
45+ const { K8sDevWorkspaceEnvVariables } = await importWithDiagnostics ( 'k8s-devworkspace-env-variables' , ( ) => import ( './impl/k8s-devworkspace-env-variables' ) ) ;
46+ const { K8sWorkspaceServiceImpl } = await importWithDiagnostics ( 'k8s-workspace-service-impl' , ( ) => import ( './impl/k8s-workspace-service-impl' ) ) ;
47+ const { GithubServiceImpl } = await importWithDiagnostics ( 'github-service-impl' , ( ) => import ( './impl/github-service-impl' ) ) ;
48+ const { K8sTelemetryServiceImpl } = await importWithDiagnostics ( 'k8s-telemetry-service-impl' , ( ) => import ( './impl/k8s-telemetry-service-impl' ) ) ;
4549
4650 const container = new Container ( ) ;
4751 container . bind ( K8sDevfileServiceImpl ) . toSelf ( ) . inSingletonScope ( ) ;
0 commit comments