Files
klz-cables.com/.pnpm-store/v10/files/c7/267ecda36c604cea62eb9cdd09eefbe7a59f01233d6e837878b370cd452cc432f5436a563b99f7a502d4782015c99efb48cdbd7d4cbbf0ae7db112d8e1bc94
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

52 lines
1.3 KiB
Plaintext

import { GLOBAL_OBJ } from '../utils/worldwide.js';
import { addHandler, maybeInstrument, triggerHandlers } from './handlers.js';
let _oldOnErrorHandler = null;
/**
* Add an instrumentation handler for when an error is captured by the global error handler.
*
* Use at your own risk, this might break without changelog notice, only used internally.
* @hidden
*/
function addGlobalErrorInstrumentationHandler(handler) {
const type = 'error';
addHandler(type, handler);
maybeInstrument(type, instrumentError);
}
function instrumentError() {
_oldOnErrorHandler = GLOBAL_OBJ.onerror;
// Note: The reason we are doing window.onerror instead of window.addEventListener('error')
// is that we are using this handler in the Loader Script, to handle buffered errors consistently
GLOBAL_OBJ.onerror = function (
msg,
url,
line,
column,
error,
) {
const handlerData = {
column,
error,
line,
msg,
url,
};
triggerHandlers('error', handlerData);
if (_oldOnErrorHandler) {
// eslint-disable-next-line prefer-rest-params
return _oldOnErrorHandler.apply(this, arguments);
}
return false;
};
GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;
}
export { addGlobalErrorInstrumentationHandler };
//# sourceMappingURL=globalError.js.map