Skip to content

Commit f195952

Browse files
committed
Simplify wf error transition
1 parent f06c658 commit f195952

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

internal/workflow/executor.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func (e *executor) ExecuteTask(ctx context.Context, t *backend.WorkflowTask) (*E
186186
if err != nil {
187187
logger.Error("Error while executing new events", "error", err)
188188

189+
// Transition workflow to error state
189190
e.workflowCompleted(nil, err)
190191
}
191192
}
@@ -275,16 +276,11 @@ func (e *executor) executeNewEvents(newEvents []*history.Event) ([]*history.Even
275276
}
276277
slices.Sort(pending)
277278

278-
e.logger.Error("workflow completed, but there are still pending futures", "pending", pending)
279-
280-
// Transition workflow to error state
281-
e.workflowCompleted(nil, fmt.Errorf("workflow completed, but there are still pending futures: %s", pending))
282-
283279
if testing.Testing() {
284280
panic(fmt.Sprintf("workflow completed, but there are still pending futures: %s", pending))
285281
}
286282

287-
return newEvents, nil
283+
return newEvents, fmt.Errorf("workflow completed, but there are still pending futures: %s", pending)
288284
}
289285

290286
if canErr, ok := e.workflow.Error().(*continueasnew.Error); ok {

0 commit comments

Comments
 (0)