Skip to content

Commit fc6e8fd

Browse files
committed
1 parent 39587fe commit fc6e8fd

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/vs/workbench/contrib/debug/browser/debugSession.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class DebugSession implements IDebugSession {
190190
try {
191191
const customTelemetryService = await dbgr.getCustomTelemetryService();
192192
const debugAdapter = await dbgr.createDebugAdapter(this);
193-
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.extensionHostDebugService, this.openerService);
193+
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.extensionHostDebugService, this.openerService, this.notificationService);
194194

195195
await this.raw.start();
196196
this.registerListeners();
@@ -693,7 +693,6 @@ export class DebugSession implements IDebugSession {
693693
await this.raw.configurationDone();
694694
} catch (e) {
695695
// Disconnect the debug session on configuration done error #10596
696-
this.notificationService.error(e);
697696
if (this.raw) {
698697
this.raw.disconnect();
699698
}

src/vs/workbench/contrib/debug/browser/rawDebugSession.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { env as processEnv } from 'vs/base/common/process';
1919
import { IOpenerService } from 'vs/platform/opener/common/opener';
2020
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
2121
import { CancellationToken } from 'vs/base/common/cancellation';
22+
import { INotificationService } from 'vs/platform/notification/common/notification';
2223

2324
/**
2425
* 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 {
7980
private readonly telemetryService: ITelemetryService,
8081
public readonly customTelemetryService: ITelemetryService | undefined,
8182
private readonly extensionHostDebugService: IExtensionHostDebugService,
82-
private readonly openerService: IOpenerService
83+
private readonly openerService: IOpenerService,
84+
private readonly notificationService: INotificationService
8385
) {
8486
this.debugAdapter = debugAdapter;
8587
this._capabilities = Object.create(null);
@@ -632,24 +634,28 @@ export class RawDebugSession implements IDisposable {
632634
return errors.canceled();
633635
}
634636

635-
const error = errorResponse && errorResponse.body ? errorResponse.body.error : null;
636-
const errorMessage = errorResponse ? errorResponse.message || '' : '';
637+
const error: DebugProtocol.Message | undefined = errorResponse?.body?.error;
638+
const errorMessage = errorResponse?.message || '';
637639

638640
if (error && error.sendTelemetry) {
639641
const telemetryMessage = error ? formatPII(error.format, true, error.variables) : errorMessage;
640642
this.telemetryDebugProtocolErrorResponse(telemetryMessage);
641643
}
642644

643645
const userMessage = error ? formatPII(error.format, false, error.variables) : errorMessage;
644-
if (error && error.url) {
646+
const url = error?.url;
647+
if (error && url) {
645648
const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info");
646649
return createErrorWithActions(userMessage, {
647650
actions: [new Action('debug.moreInfo', label, undefined, true, () => {
648-
this.openerService.open(URI.parse(error.url));
651+
this.openerService.open(URI.parse(url));
649652
return Promise.resolve(null);
650653
})]
651654
});
652655
}
656+
if (error && error.format && error.showUser) {
657+
this.notificationService.error(error.format);
658+
}
653659

654660
return new Error(userMessage);
655661
}

src/vs/workbench/contrib/debug/common/debugUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { deepClone } from 'vs/base/common/objects';
1111

1212
const _formatPIIRegexp = /{([^}]+)}/g;
1313

14-
export function formatPII(value: string, excludePII: boolean, args: { [key: string]: string }): string {
14+
export function formatPII(value: string, excludePII: boolean, args: { [key: string]: string } | undefined): string {
1515
return value.replace(_formatPIIRegexp, function (match, group) {
1616
if (excludePII && group.length > 0 && group[0] !== '_') {
1717
return match;

src/vs/workbench/contrib/debug/test/browser/repl.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ suite('Debug - REPL', () => {
135135
model.addSession(session);
136136

137137
const adapter = new MockDebugAdapter();
138-
const raw = new RawDebugSession(adapter, undefined!, undefined!, undefined!, undefined!, undefined!);
138+
const raw = new RawDebugSession(adapter, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
139139
session.initializeForTest(raw);
140140

141141
await session.addReplExpression(undefined, 'before.1');

0 commit comments

Comments
 (0)