@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
8
8
import { getMarks , mark } from 'vs/base/common/performance' ;
9
9
import { Emitter } from 'vs/base/common/event' ;
10
10
import { URI } from 'vs/base/common/uri' ;
11
- import { screen , BrowserWindow , systemPreferences , app , TouchBar , nativeImage , Rectangle , Display , TouchBarSegmentedControl , NativeImage , BrowserWindowConstructorOptions , SegmentedControlSegment , Event , RenderProcessGoneDetails , WebFrameMain } from 'electron' ;
11
+ import { screen , BrowserWindow , systemPreferences , app , TouchBar , nativeImage , Rectangle , Display , TouchBarSegmentedControl , NativeImage , BrowserWindowConstructorOptions , SegmentedControlSegment , Event , WebFrameMain } from 'electron' ;
12
12
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService' ;
13
13
import { ILogService } from 'vs/platform/log/common/log' ;
14
14
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
@@ -419,7 +419,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
419
419
// Crashes & Unresponsive & Failed to load
420
420
this . _win . on ( 'unresponsive' , ( ) => this . onWindowError ( WindowError . UNRESPONSIVE ) ) ;
421
421
this . _win . webContents . on ( 'render-process-gone' , ( event , details ) => this . onWindowError ( WindowError . CRASHED , details ) ) ;
422
- this . _win . webContents . on ( 'did-fail-load' , ( event , errorCode , errorDescription ) => this . onWindowError ( WindowError . LOAD , errorDescription ) ) ;
422
+ this . _win . webContents . on ( 'did-fail-load' , ( event , exitCode , reason ) => this . onWindowError ( WindowError . LOAD , { reason , exitCode } ) ) ;
423
423
424
424
// Prevent windows/iframes from blocking the unload
425
425
// through DOM events. We have our own logic for
@@ -551,19 +551,19 @@ export class CodeWindow extends Disposable implements ICodeWindow {
551
551
}
552
552
553
553
private async onWindowError ( error : WindowError . UNRESPONSIVE ) : Promise < void > ;
554
- private async onWindowError ( error : WindowError . CRASHED , details : RenderProcessGoneDetails ) : Promise < void > ;
555
- private async onWindowError ( error : WindowError . LOAD , details : string ) : Promise < void > ;
556
- private async onWindowError ( type : WindowError , details ?: string | RenderProcessGoneDetails ) : Promise < void > {
554
+ private async onWindowError ( error : WindowError . CRASHED , details : { reason : string , exitCode : number } ) : Promise < void > ;
555
+ private async onWindowError ( error : WindowError . LOAD , details : { reason : string , exitCode : number } ) : Promise < void > ;
556
+ private async onWindowError ( type : WindowError , details ?: { reason : string , exitCode : number } ) : Promise < void > {
557
557
558
558
switch ( type ) {
559
559
case WindowError . CRASHED :
560
- this . logService . error ( `CodeWindow: renderer process crashed (detail : ${ typeof details === 'string' ? details : details ? .reason } , code: ${ typeof details === 'string' ? '<unknown>' : details ?. exitCode ?? '<unknown>' } )` ) ;
560
+ this . logService . error ( `CodeWindow: renderer process crashed (reason : ${ details ? .reason ?? '<unknown>' } , code: ${ details ?. exitCode ?? '<unknown>' } )` ) ;
561
561
break ;
562
562
case WindowError . UNRESPONSIVE :
563
563
this . logService . error ( 'CodeWindow: detected unresponsive' ) ;
564
564
break ;
565
565
case WindowError . LOAD :
566
- this . logService . error ( `CodeWindow: failed to load workbench window: ${ typeof details === 'string' ? details : details ?. reason } ` ) ;
566
+ this . logService . error ( `CodeWindow: failed to load workbench window (reason : ${ details ?. reason ?? '<unknown>' } , code: ${ details ?. exitCode ?? '<unknown>' } ) ` ) ;
567
567
break ;
568
568
}
569
569
@@ -579,12 +579,14 @@ export class CodeWindow extends Disposable implements ICodeWindow {
579
579
type WindowErrorClassification = {
580
580
type : { classification : 'SystemMetaData' , purpose : 'PerformanceAndHealth' , isMeasurement : true } ;
581
581
reason : { classification : 'SystemMetaData' , purpose : 'PerformanceAndHealth' , isMeasurement : true } ;
582
+ code : { classification : 'SystemMetaData' , purpose : 'PerformanceAndHealth' , isMeasurement : true } ;
582
583
} ;
583
584
type WindowErrorEvent = {
584
585
type : WindowError ;
585
586
reason : string | undefined ;
587
+ code : number | undefined ;
586
588
} ;
587
- this . telemetryService . publicLog2 < WindowErrorEvent , WindowErrorClassification > ( 'windowerror' , { type, reason : typeof details !== 'string' ? details ? .reason : undefined } ) ;
589
+ this . telemetryService . publicLog2 < WindowErrorEvent , WindowErrorClassification > ( 'windowerror' , { type, reason : details ? .reason , code : details ?. exitCode } ) ;
588
590
589
591
// Unresponsive
590
592
if ( type === WindowError . UNRESPONSIVE ) {
@@ -623,10 +625,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
623
625
// Crashed
624
626
else if ( type === WindowError . CRASHED ) {
625
627
let message : string ;
626
- if ( typeof details === 'string' || ! details ) {
628
+ if ( ! details ) {
627
629
message = localize ( 'appCrashed' , "The window has crashed" ) ;
628
630
} else {
629
- message = localize ( 'appCrashedDetails' , "The window has crashed (reason: '{0}')" , details . reason ) ;
631
+ message = localize ( 'appCrashedDetails' , "The window has crashed (reason: '{0}', code: '{1}' )" , details . reason , details . exitCode ?? '<unknown>' ) ;
630
632
}
631
633
632
634
const result = await this . dialogMainService . showMessageBox ( {
0 commit comments