Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._subs.push(ipcMain.on(Constants.IpcEvent.sendTelemetry, ({ telemetry, type }) => {
// We need to deserialize the error otherwise appinsights will do it and will lose the stacktrace
if (type === TelemetryType.Exception) {
if (telemetry.exception) {
let error;
if (telemetry.exception.sanitizedMessage) {
error = new SanitizedError(telemetry.exception.sanitizedMessage);
} else {
error = new Error();
error.message = telemetry.exception.message;
}
error.name = telemetry.exception.name;
error.stack = telemetry.exception.stack;
telemetry.exception = error;
}
}
this.telemetryService.track(telemetry, type);
return Promise.resolve();