4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import { Barrier } from 'vs/base/common/async' ;
7
+ import { toErrorMessage } from 'vs/base/common/errorMessage' ;
7
8
import { Emitter } from 'vs/base/common/event' ;
8
9
import { Disposable } from 'vs/base/common/lifecycle' ;
9
10
import { Schemas } from 'vs/base/common/network' ;
@@ -653,7 +654,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
653
654
654
655
private async _doStopExtensionHostsWithVeto ( reason : string ) : Promise < boolean > {
655
656
const vetos : ( boolean | Promise < boolean > ) [ ] = [ ] ;
656
- const vetoReasons : string [ ] = [ ] ;
657
+ const vetoReasons = new Set < string > ( ) ;
657
658
658
659
this . _onWillStop . fire ( {
659
660
reason,
@@ -662,13 +663,15 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
662
663
663
664
if ( typeof value === 'boolean' ) {
664
665
if ( value === true ) {
665
- vetoReasons . push ( reason ) ;
666
+ vetoReasons . add ( reason ) ;
666
667
}
667
668
} else {
668
669
value . then ( value => {
669
670
if ( value ) {
670
- vetoReasons . push ( reason ) ;
671
+ vetoReasons . add ( reason ) ;
671
672
}
673
+ } ) . catch ( error => {
674
+ vetoReasons . add ( nls . localize ( 'extensionStopVetoError' , "{0} (Error: {1})" , reason , toErrorMessage ( error ) ) ) ;
672
675
} ) ;
673
676
}
674
677
}
@@ -678,13 +681,15 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
678
681
if ( ! veto ) {
679
682
this . _doStopExtensionHosts ( ) ;
680
683
} else {
681
- this . _logService . warn ( `Extension host was not stopped because of veto (stop reason: ${ reason } , veto reason: ${ vetoReasons . join ( ', ' ) } )` ) ;
684
+ const vetoReasonsArray = Array . from ( vetoReasons ) ;
685
+
686
+ this . _logService . warn ( `Extension host was not stopped because of veto (stop reason: ${ reason } , veto reason: ${ vetoReasonsArray . join ( ', ' ) } )` ) ;
682
687
683
688
await this . _dialogService . warn (
684
689
nls . localize ( 'extensionStopVetoMessage' , "The following operation was blocked: {0}" , reason ) ,
685
- vetoReasons . length === 1 ?
686
- nls . localize ( 'extensionStopVetoDetailsOne' , "The reason for blocking the operation: {0}" , vetoReasons [ 0 ] ) :
687
- nls . localize ( 'extensionStopVetoDetailsMany' , "The reasons for blocking the operation:\n- {0}" , vetoReasons . join ( '\n -' ) ) ,
690
+ vetoReasonsArray . length === 1 ?
691
+ nls . localize ( 'extensionStopVetoDetailsOne' , "The reason for blocking the operation: {0}" , vetoReasonsArray [ 0 ] ) :
692
+ nls . localize ( 'extensionStopVetoDetailsMany' , "The reasons for blocking the operation:\n- {0}" , vetoReasonsArray . join ( '\n -' ) ) ,
688
693
) ;
689
694
}
690
695
0 commit comments