UNPKG

@grafana/faro-web-sdk

Version:

Faro instrumentations, metas, transports for web.

24 lines 907 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.registerOnerror = registerOnerror; const getErrorDetails_1 = require("./getErrorDetails"); function registerOnerror(api) { const oldOnerror = window.onerror; window.onerror = (...args) => { try { const { value, type, stackFrames } = (0, getErrorDetails_1.getDetailsFromErrorArgs)(args); const originalError = args[4]; if (value) { const options = { type, stackFrames }; if (originalError != null) { options.originalError = originalError; } api.pushError(new Error(value), options); } } finally { oldOnerror === null || oldOnerror === void 0 ? void 0 : oldOnerror.apply(window, args); } }; } //# sourceMappingURL=registerOnerror.js.map