@@ -134,8 +134,6 @@ export class TaskExecutor {
134134
135135 const output = await this . #callRun( parsedPayload , ctx , initOutput , signal ) ;
136136
137- await this . #callOnSuccessFunctions( parsedPayload , output , ctx , initOutput , signal ) ;
138-
139137 try {
140138 const stringifiedOutput = await stringifyIO ( output ) ;
141139
@@ -155,6 +153,8 @@ export class TaskExecutor {
155153 span . setAttributes ( attributes ) ;
156154 }
157155
156+ await this . #callOnSuccessFunctions( parsedPayload , output , ctx , initOutput , signal ) ;
157+
158158 // Call onComplete with success result
159159 await this . #callOnCompleteFunctions(
160160 parsedPayload ,
@@ -173,15 +173,6 @@ export class TaskExecutor {
173173 } catch ( outputError ) {
174174 recordSpanException ( span , outputError ) ;
175175
176- // Call onComplete with error result
177- await this . #callOnCompleteFunctions(
178- parsedPayload ,
179- { ok : false , error : outputError } ,
180- ctx ,
181- initOutput ,
182- signal
183- ) ;
184-
185176 return {
186177 ok : false ,
187178 id : execution . run . id ,
@@ -243,15 +234,6 @@ export class TaskExecutor {
243234 } catch ( handleErrorError ) {
244235 recordSpanException ( span , handleErrorError ) ;
245236
246- // Call onComplete with error result
247- await this . #callOnCompleteFunctions(
248- parsedPayload ,
249- { ok : false , error : handleErrorError } ,
250- ctx ,
251- initOutput ,
252- signal
253- ) ;
254-
255237 return {
256238 ok : false ,
257239 id : execution . run . id ,
0 commit comments