src/vs/platform/windows/electron-main/window.ts/CodeWindow/onWindowError
class CodeWindow:	private async onWindowError(type: WindowError, details?: { reason: string, exitCode: number }): Promise<void> {

		switch (type) {
			case WindowError.CRASHED:
				this.logService.error(`CodeWindow: renderer process crashed (reason: ${details?.reason || '<unknown>'}, code: ${details?.exitCode || '<unknown>'})`);
				break;
			case WindowError.UNRESPONSIVE:
				this.logService.error('CodeWindow: detected unresponsive');
				break;
			case WindowError.LOAD:
				this.logService.error(`CodeWindow: failed to load (reason: ${details?.reason || '<unknown>'}, code: ${details?.exitCode || '<unknown>'})`);
				break;
		}

		// Telemetry
		type WindowErrorClassification = {
			type: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth', isMeasurement: true };
			reason: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth', isMeasurement: true };
			code: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth', isMeasurement: true };
		};
		type WindowErrorEvent = {
			type: WindowError;
			reason: string | undefined;
			code: number | undefined;
		};
		this.telemetryService.publicLog2<WindowErrorEvent, WindowErrorClassification>('windowerror', { type, reason: details?.reason, code: details?.exitCode });

		// Inform User if non-recoverable
		switch (type) {
			case WindowError.UNRESPONSIVE:
			case WindowError.CRASHED:

				// If we run extension tests from CLI, showing a dialog is not
				// very helpful in this case. Rather, we bring down the test run
				// to signal back a failing run.
				if (this.isExtensionDevelopmentTestFromCli) {
					this.lifecycleMainService.kill(1);
					return;
				}

				// Unresponsive
				if (type === WindowError.UNRESPONSIVE) {
					if (this.isExtensionDevelopmentHost || this.isExtensionTestHost || (this._win && this._win.webContents && this._win.webContents.isDevToolsOpened())) {
						// TODO@electron Workaround for https://github.com/microsoft/vscode/issues/56994
						// In certain cases the window can report unresponsiveness because a breakpoint was hit
						// and the process is stopped executing. The most typical cases are:
						// - devtools are opened and debugging happens
						// - window is an extensions development host that is being debugged
						// - window is an extension test development host that is being debugged
						return;
					}

					// Show Dialog
					const result = await this.dialogMainService.showMessageBox({
						title: this.productService.nameLong,
						type: 'warning',
						buttons: [
							mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")),
							mnemonicButtonLabel(localize({ key: 'wait', comment: ['&& denotes a mnemonic'] }, "&&Keep Waiting")),
							mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))
						],
						message: localize('appStalled', "The window is not responding"),
						detail: localize('appStalledDetail', "You can reopen or close the window or keep waiting."),
						noLink: true,
						defaultId: 0,
						cancelId: 1
					}, this._win);

					if (!this._win) {
						return; // Return early if the window has been going down already
					}

					if (result.response === 0) {
						this._win.webContents.forcefullyCrashRenderer(); // Calling reload() immediately after calling this method will force the reload to occur in a new process
						this.reload();
					} else if (result.response === 2) {
						this.destroyWindow();
					}
				}

				// Crashed
				else if (type === WindowError.CRASHED) {
					let message: string;
					if (!details) {
						message = localize('appCrashed', "The window has crashed");
					} else {
						message = localize('appCrashedDetails', "The window has crashed (reason: '{0}', code: '{1}')", details.reason, details.exitCode ?? '<unknown>');
					}

					const result = await this.dialogMainService.showMessageBox({
						title: this.productService.nameLong,
						type: 'warning',
						buttons: [
							mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")),
							mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))
						],
						message,
						detail: localize('appCrashedDetail', "We are sorry for the inconvenience. You can reopen the window to continue where you left off."),
						noLink: true,
						defaultId: 0
					}, this._win);

					if (!this._win) {
						return; // Return early if the window has been going down already
					}

					if (result.response === 0) {
						this.reload();
					} else if (result.response === 1) {
						this.destroyWindow();
					}
				}
				break;
		}
	}