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

Function apply

packages/core/src/integrations/supabase.ts:241–287  ·  view source on GitHub ↗
(target, thisArg, argumentsList)

Source from the content-addressed store, hash-verified

239function instrumentAuthOperation(operation: AuthOperationFn, isAdmin = false): AuthOperationFn {
240 return new Proxy(operation, {
241 apply(target, thisArg, argumentsList) {
242 return startSpan(
243 {
244 name: `auth ${isAdmin ? '(admin) ' : ''}${operation.name}`,
245 attributes: {
246 [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase',
247 [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db',
248 'db.system': 'postgresql',
249 'db.operation': `auth.${isAdmin ? 'admin.' : ''}${operation.name}`,
250 },
251 },
252 span => {
253 return Reflect.apply(target, thisArg, argumentsList)
254 .then((res: unknown) => {
255 if (res && typeof res === 'object' && 'error' in res && res.error) {
256 span.setStatus({ code: SPAN_STATUS_ERROR });
257
258 captureException(res.error, {
259 mechanism: {
260 handled: false,
261 type: 'auto.db.supabase.auth',
262 },
263 });
264 } else {
265 span.setStatus({ code: SPAN_STATUS_OK });
266 }
267
268 span.end();
269 return res;
270 })
271 .catch((err: unknown) => {
272 span.setStatus({ code: SPAN_STATUS_ERROR });
273 span.end();
274
275 captureException(err, {
276 mechanism: {
277 handled: false,
278 type: 'auto.db.supabase.auth',
279 },
280 });
281
282 throw err;
283 })
284 .then(...argumentsList);
285 },
286 );
287 },
288 });
289}
290

Callers

nothing calls this directly

Calls 15

startSpanFunction · 0.90
captureExceptionFunction · 0.90
isPlainObjectFunction · 0.90
getClientFunction · 0.90
setHttpStatusFunction · 0.90
addExceptionMechanismFunction · 0.90
addBreadcrumbFunction · 0.90
extractOperationFunction · 0.85

Tested by

no test coverage detected