How to use the applicationinsights/out/Declarations/Contracts.TelemetryType.Exception function in applicationinsights

To help you get started, we’ve selected a few applicationinsights examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / BatchExplorer / src / client / core / telemetry / telemetry-manager.ts View on Github external
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();