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

Function monitoredCallback

packages/node-core/src/cron/node-cron.ts:54–79  ·  view source on GitHub ↗
(...args: Parameters<typeof callback>)

Source from the content-addressed store, hash-verified

52 }
53
54 const monitoredCallback = async (...args: Parameters<typeof callback>): Promise<void> => {
55 return withMonitor(
56 name,
57 async () => {
58 // We have to manually catch here and capture the exception because node-cron swallows errors
59 // https://github.com/node-cron/node-cron/issues/399
60 try {
61 // oxlint-disable-next-line typescript/await-thenable -- callback may be async at runtime
62 return await callback(...args);
63 } catch (e) {
64 captureException(e, {
65 mechanism: {
66 handled: false,
67 type: 'auto.function.node-cron.instrumentNodeCron',
68 },
69 });
70 throw e;
71 }
72 },
73 {
74 schedule: { type: 'crontab', value: replaceCronNames(expression) },
75 timezone,
76 ...monitorConfig,
77 },
78 );
79 };
80
81 return target.apply(thisArg, [expression, monitoredCallback, options]);
82 },

Callers

nothing calls this directly

Calls 4

withMonitorFunction · 0.90
captureExceptionFunction · 0.90
replaceCronNamesFunction · 0.90
callbackFunction · 0.50

Tested by

no test coverage detected