File tree 3 files changed +17
-7
lines changed 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @trigger.dev/core " : patch
3
+ ---
4
+
5
+ Pass init output to both local and global ` handleError ` functions
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ export type HandleErrorResult =
127
127
128
128
export type HandleErrorArgs = {
129
129
ctx : Context ;
130
+ init : unknown ;
130
131
retry ?: RetryOptions ;
131
132
retryAt ?: Date ;
132
133
retryDelayInMs ?: number ;
@@ -152,9 +153,9 @@ type CommonTaskOptions<
152
153
/** The retry settings when an uncaught error is thrown.
153
154
*
154
155
* If omitted it will use the values in your `trigger.config.ts` file.
155
- *
156
+ *
156
157
* @example
157
- *
158
+ *
158
159
* ```
159
160
* export const taskWithRetries = task({
160
161
id: "task-with-retries",
@@ -174,10 +175,10 @@ type CommonTaskOptions<
174
175
retry ?: RetryOptions ;
175
176
176
177
/** Used to configure what should happen when more than one run is triggered at the same time.
177
- *
178
- * @example
178
+ *
179
+ * @example
179
180
* one at a time execution
180
- *
181
+ *
181
182
* ```ts
182
183
* export const oneAtATime = task({
183
184
id: "one-at-a-time",
@@ -192,9 +193,9 @@ type CommonTaskOptions<
192
193
*/
193
194
queue ?: QueueOptions ;
194
195
/** Configure the spec of the machine you want your task to run on.
195
- *
196
+ *
196
197
* @example
197
- *
198
+ *
198
199
* ```ts
199
200
* export const heavyTask = task({
200
201
id: "heavy-task",
Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ export class TaskExecutor {
176
176
runError ,
177
177
parsedPayload ,
178
178
ctx ,
179
+ initOutput ,
179
180
signal
180
181
) ;
181
182
@@ -498,6 +499,7 @@ export class TaskExecutor {
498
499
error : unknown ,
499
500
payload : any ,
500
501
ctx : TaskRunContext ,
502
+ init : unknown ,
501
503
signal ?: AbortSignal
502
504
) : Promise <
503
505
| { status : "retry" ; retry : TaskRunExecutionRetry ; error ?: unknown }
@@ -550,6 +552,7 @@ export class TaskExecutor {
550
552
const handleErrorResult = this . task . fns . handleError
551
553
? await this . task . fns . handleError ( payload , error , {
552
554
ctx,
555
+ init,
553
556
retry,
554
557
retryDelayInMs : delay ,
555
558
retryAt : delay ? new Date ( Date . now ( ) + delay ) : undefined ,
@@ -558,6 +561,7 @@ export class TaskExecutor {
558
561
: this . _importedConfig
559
562
? await this . _handleErrorFn ?.( payload , error , {
560
563
ctx,
564
+ init,
561
565
retry,
562
566
retryDelayInMs : delay ,
563
567
retryAt : delay ? new Date ( Date . now ( ) + delay ) : undefined ,
You can’t perform that action at this time.
0 commit comments