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

Function apply

packages/nuxt/src/runtime/utils/instrumentStorage.ts:149–179  ·  view source on GitHub ↗
(target, thisArg, args)

Source from the content-addressed store, hash-verified

147): (...args: unknown[]) => unknown {
148 return new Proxy(original, {
149 async apply(target, thisArg, args) {
150 const options = createSpanStartOptions(methodName, driver, mountBase, args);
151
152 debug.log(`[storage] Running method: "${methodName}" on driver: "${driver.name ?? 'unknown'}"`);
153
154 return startSpan(options, async span => {
155 try {
156 const result = await target.apply(thisArg, args);
157 span.setStatus({ code: SPAN_STATUS_OK });
158
159 if (CACHE_HIT_METHODS.has(methodName)) {
160 span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT, isCacheHit(args[0], result));
161 }
162
163 return result;
164 } catch (error) {
165 span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });
166 captureException(error, {
167 mechanism: {
168 handled: false,
169 type: options.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN],
170 },
171 });
172
173 // Re-throw the error to be handled by the caller
174 throw error;
175 } finally {
176 await flushIfServerless();
177 }
178 });
179 },
180 });
181}
182

Callers

nothing calls this directly

Calls 10

startSpanFunction · 0.90
captureExceptionFunction · 0.90
flushIfServerlessFunction · 0.90
createSpanStartOptionsFunction · 0.85
isCacheHitFunction · 0.70
logMethod · 0.65
setStatusMethod · 0.65
hasMethod · 0.65
setAttributeMethod · 0.65
applyMethod · 0.45

Tested by

no test coverage detected