MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / wrapper

Function wrapper

packages/node-core/src/integrations/console.ts:80–95  ·  view source on GitHub ↗
(...args: any[])

Source from the content-addressed store, hash-verified

78 let isExecuting = false;
79
80 const wrapper = function (...args: any[]): void {
81 if (isExecuting) {
82 // Re-entrant call: a third party captured `wrapper` via the getter and calls it from inside their replacement. We must
83 // use `nativeMethod` (not `delegate`) to break the cycle, and we intentionally skip `triggerHandlers` to avoid duplicate
84 // breadcrumbs. The outer invocation already triggered the handlers for this console call.
85 nativeMethod.apply(consoleObj, args);
86 return;
87 }
88 isExecuting = true;
89 try {
90 triggerHandlers('console', { args, level } as HandlerDataConsole);
91 delegate.apply(consoleObj, args);
92 } finally {
93 isExecuting = false;
94 }
95 };
96 markFunctionWrapped(wrapper as unknown as WrappedFunction, nativeMethod as unknown as WrappedFunction);
97
98 // consoleSandbox reads originalConsoleMethods[level] to temporarily bypass instrumentation. We replace it with a distinct reference (.bind creates a

Callers 7

startSpanFunction · 0.85
startSpanManualFunction · 0.85
startInactiveSpanFunction · 0.85
propwrapFunction · 0.85
_startSpanFunction · 0.85
startInactiveSpanFunction · 0.85
_patchMethodFunction · 0.85

Calls 2

triggerHandlersFunction · 0.90
applyMethod · 0.45

Tested by

no test coverage detected