Skip to content

Commit 175e690

Browse files
authored
AsyncSequenceWorker’s should not throw errors (#355)
Added catch for errors in AsyncSequenceWorker. ## Checklist - [x] Unit Tests - [ ] UI Tests - [ ] Snapshot Tests (iOS only) - [ ] I have made corresponding changes to the documentation
1 parent 8e0ddb0 commit 175e690

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

WorkflowConcurrency/Sources/AsyncSequenceWorker.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ struct AsyncSequenceWorkerWorkflow<WorkerType: AsyncSequenceWorker>: Workflow {
5151
context.runSideEffect(key: state) { lifetime in
5252
let sequence = worker.run()
5353
let task = Task { @MainActor in
54-
for try await output in sequence {
55-
sink.send(AnyWorkflowAction(sendingOutput: output))
54+
do {
55+
for try await output in sequence {
56+
sink.send(AnyWorkflowAction(sendingOutput: output))
57+
}
58+
} catch {
59+
fatalError("AsyncSequenceWorker implementations should not throw errors on iteration: \(error)")
5660
}
5761
}
5862

0 commit comments

Comments
 (0)