Files
klz-cables.com/.pnpm-store/v10/files/c0/31cd9e58d99bdc4a57367328205ef73325f9d219e82db343e17d239a0d84e23a1a26a34c20187ea745674ea5a4412875935a64a9409815fa65ff46b69c2587
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

87 lines
2.8 KiB
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const core = require('@sentry/core');
function isReactClassComponent(target) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return typeof target === 'function' && target?.prototype?.isReactComponent;
}
/**
* Wraps a page component with Sentry error instrumentation.
*/
function wrapPageComponentWithSentry(pageComponent) {
if (isReactClassComponent(pageComponent)) {
return class SentryWrappedPageComponent extends pageComponent {
render(...args) {
return core.withIsolationScope(() => {
const scope = core.getCurrentScope();
// We extract the sentry trace data that is put in the component props by datafetcher wrappers
const sentryTraceData =
typeof this.props === 'object' &&
this.props !== null &&
'_sentryTraceData' in this.props &&
typeof this.props._sentryTraceData === 'string'
? this.props._sentryTraceData
: undefined;
if (sentryTraceData) {
const traceparentData = core.extractTraceparentData(sentryTraceData);
scope.setContext('trace', {
span_id: traceparentData?.parentSpanId,
trace_id: traceparentData?.traceId,
});
}
try {
return super.render(...args);
} catch (e) {
core.captureException(e, {
mechanism: {
handled: false,
type: 'auto.function.nextjs.page_class',
},
});
throw e;
}
});
}
};
} else if (typeof pageComponent === 'function') {
return new Proxy(pageComponent, {
apply(target, thisArg, argArray) {
return core.withIsolationScope(() => {
const scope = core.getCurrentScope();
// We extract the sentry trace data that is put in the component props by datafetcher wrappers
const sentryTraceData = argArray?.[0]?._sentryTraceData;
if (sentryTraceData) {
const traceparentData = core.extractTraceparentData(sentryTraceData);
scope.setContext('trace', {
span_id: traceparentData?.parentSpanId,
trace_id: traceparentData?.traceId,
});
}
try {
return target.apply(thisArg, argArray);
} catch (e) {
core.captureException(e, {
mechanism: {
handled: false,
type: 'auto.function.nextjs.page_function',
},
});
throw e;
}
});
},
});
} else {
return pageComponent;
}
}
exports.wrapPageComponentWithSentry = wrapPageComponentWithSentry;
//# sourceMappingURL=wrapPageComponentWithSentry.js.map