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

Function apply

packages/nuxt/src/runtime/utils/patchEventHandler.ts:16–33  ·  view source on GitHub ↗
(handlerTarget, handlerThisArg, handlerArgs: unknown)

Source from the content-addressed store, hash-verified

14export function patchEventHandler<H3EventHandler extends Function>(handler: H3EventHandler): H3EventHandler {
15 return new Proxy(handler, {
16 async apply(handlerTarget, handlerThisArg, handlerArgs: unknown) {
17 const isolationScope = getIsolationScope();
18 const newIsolationScope = isolationScope === getDefaultIsolationScope() ? isolationScope.clone() : isolationScope;
19
20 debug.log(
21 `Patched h3 event handler. ${
22 isolationScope === newIsolationScope ? 'Using existing' : 'Created new'
23 } isolation scope.`,
24 );
25
26 return withIsolationScope(newIsolationScope, async () => {
27 try {
28 return await handlerTarget.apply(handlerThisArg, handlerArgs);
29 } finally {
30 await flushIfServerless();
31 }
32 });
33 },
34 });
35}

Callers

nothing calls this directly

Calls 7

getIsolationScopeFunction · 0.90
getDefaultIsolationScopeFunction · 0.90
withIsolationScopeFunction · 0.90
flushIfServerlessFunction · 0.90
cloneMethod · 0.65
logMethod · 0.65
applyMethod · 0.45

Tested by

no test coverage detected