File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/node-core/src/cron Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,11 @@ export interface NodeCronOptions {
7
7
}
8
8
9
9
export interface NodeCron {
10
- schedule : ( cronExpression : string , callback : ( ) => void , options : NodeCronOptions | undefined ) => unknown ;
10
+ schedule : (
11
+ cronExpression : string ,
12
+ callback : ( context ?: unknown ) => void ,
13
+ options : NodeCronOptions | undefined ,
14
+ ) => unknown ;
11
15
}
12
16
13
17
/**
@@ -44,14 +48,14 @@ export function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T {
44
48
throw new Error ( 'Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.' ) ;
45
49
}
46
50
47
- const monitoredCallback = async ( ) : Promise < void > => {
51
+ const monitoredCallback = async ( context : unknown ) : Promise < void > => {
48
52
return withMonitor (
49
53
name ,
50
54
async ( ) => {
51
55
// We have to manually catch here and capture the exception because node-cron swallows errors
52
56
// https://github.com/node-cron/node-cron/issues/399
53
57
try {
54
- return await callback ( ) ;
58
+ return await callback ( context ) ;
55
59
} catch ( e ) {
56
60
captureException ( e , {
57
61
mechanism : {
You can’t perform that action at this time.
0 commit comments