(...args: Parameters<typeof callback>)
| 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 | }, |
nothing calls this directly
no test coverage detected