提交 fc6e8fda 编写于 作者: I isidor

fixes #89059

上级 39587fe5
......@@ -190,7 +190,7 @@ export class DebugSession implements IDebugSession {
try {
const customTelemetryService = await dbgr.getCustomTelemetryService();
const debugAdapter = await dbgr.createDebugAdapter(this);
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.extensionHostDebugService, this.openerService);
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.extensionHostDebugService, this.openerService, this.notificationService);
await this.raw.start();
this.registerListeners();
......@@ -693,7 +693,6 @@ export class DebugSession implements IDebugSession {
await this.raw.configurationDone();
} catch (e) {
// Disconnect the debug session on configuration done error #10596
this.notificationService.error(e);
if (this.raw) {
this.raw.disconnect();
}
......
......@@ -19,6 +19,7 @@ import { env as processEnv } from 'vs/base/common/process';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { CancellationToken } from 'vs/base/common/cancellation';
import { INotificationService } from 'vs/platform/notification/common/notification';
/**
* This interface represents a single command line argument split into a "prefix" and a "path" half.
......@@ -79,7 +80,8 @@ export class RawDebugSession implements IDisposable {
private readonly telemetryService: ITelemetryService,
public readonly customTelemetryService: ITelemetryService | undefined,
private readonly extensionHostDebugService: IExtensionHostDebugService,
private readonly openerService: IOpenerService
private readonly openerService: IOpenerService,
private readonly notificationService: INotificationService
) {
this.debugAdapter = debugAdapter;
this._capabilities = Object.create(null);
......@@ -632,8 +634,8 @@ export class RawDebugSession implements IDisposable {
return errors.canceled();
}
const error = errorResponse && errorResponse.body ? errorResponse.body.error : null;
const errorMessage = errorResponse ? errorResponse.message || '' : '';
const error: DebugProtocol.Message | undefined = errorResponse?.body?.error;
const errorMessage = errorResponse?.message || '';
if (error && error.sendTelemetry) {
const telemetryMessage = error ? formatPII(error.format, true, error.variables) : errorMessage;
......@@ -641,15 +643,19 @@ export class RawDebugSession implements IDisposable {
}
const userMessage = error ? formatPII(error.format, false, error.variables) : errorMessage;
if (error && error.url) {
const url = error?.url;
if (error && url) {
const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info");
return createErrorWithActions(userMessage, {
actions: [new Action('debug.moreInfo', label, undefined, true, () => {
this.openerService.open(URI.parse(error.url));
this.openerService.open(URI.parse(url));
return Promise.resolve(null);
})]
});
}
if (error && error.format && error.showUser) {
this.notificationService.error(error.format);
}
return new Error(userMessage);
}
......
......@@ -11,7 +11,7 @@ import { deepClone } from 'vs/base/common/objects';
const _formatPIIRegexp = /{([^}]+)}/g;
export function formatPII(value: string, excludePII: boolean, args: { [key: string]: string }): string {
export function formatPII(value: string, excludePII: boolean, args: { [key: string]: string } | undefined): string {
return value.replace(_formatPIIRegexp, function (match, group) {
if (excludePII && group.length > 0 && group[0] !== '_') {
return match;
......
......@@ -135,7 +135,7 @@ suite('Debug - REPL', () => {
model.addSession(session);
const adapter = new MockDebugAdapter();
const raw = new RawDebugSession(adapter, undefined!, undefined!, undefined!, undefined!, undefined!);
const raw = new RawDebugSession(adapter, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
session.initializeForTest(raw);
await session.addReplExpression(undefined, 'before.1');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册