This commit is contained in:
isidor
2020-02-05 12:40:26 +01:00
parent 39587fe58b
commit fc6e8fdac2
4 changed files with 14 additions and 9 deletions
@@ -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');