debug: differentiate telemetry and user visible message

This commit is contained in:
isidor 2016-07-19 15:50:17 +02:00
parent 00826ade84
commit a07bcd6732

View file

@ -149,11 +149,11 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
return this.initServer().then(() => {
const promise = super.send(command, args).then(response => response, (errorResponse: DebugProtocol.ErrorResponse) => {
const error = errorResponse.body ? errorResponse.body.error : null;
const message = error ? debug.formatPII(error.format, false, error.variables) : errorResponse.message;
const telemetryMessage = error ? debug.formatPII(error.format, true, error.variables) : errorResponse.message;
if (error && error.sendTelemetry) {
this.telemetryService.publicLog('debugProtocolErrorResponse', { error: message });
this.telemetryService.publicLog('debugProtocolErrorResponse', { error: telemetryMessage });
if (this.customTelemetryService) {
this.customTelemetryService.publicLog('debugProtocolErrorResponse', { error: message });
this.customTelemetryService.publicLog('debugProtocolErrorResponse', { error: telemetryMessage });
}
}
if (errors.isPromiseCanceledError(errorResponse) || (error && error.showUser === false)) {
@ -161,15 +161,16 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
return TPromise.as(null);
}
const userMessage = error ? debug.formatPII(error.format, false, error.variables) : errorResponse.message;
if (error && error.url) {
const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info");
return TPromise.wrapError(errors.create(message, { actions: [CloseAction, new Action('debug.moreInfo', label, null, true, () => {
return TPromise.wrapError(errors.create(userMessage, { actions: [CloseAction, new Action('debug.moreInfo', label, null, true, () => {
shell.openExternal(error.url);
return TPromise.as(null);
})]}));
}
return TPromise.wrapError(new Error(message));
return TPromise.wrapError(new Error(userMessage));
});
this.sentPromises.push(promise);