From 14e09b46093af8d1d586e85443757e876d4ec8f5 Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Mon, 30 Jun 2025 15:10:08 -0400 Subject: [PATCH] =?UTF-8?q?AsyncSequenceWorker=E2=80=99s=20should=20not=20?= =?UTF-8?q?throw=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added catch for errors in AsyncSequenceWorker. --- WorkflowConcurrency/Sources/AsyncSequenceWorker.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/WorkflowConcurrency/Sources/AsyncSequenceWorker.swift b/WorkflowConcurrency/Sources/AsyncSequenceWorker.swift index f1e621c3a..df717e6c5 100644 --- a/WorkflowConcurrency/Sources/AsyncSequenceWorker.swift +++ b/WorkflowConcurrency/Sources/AsyncSequenceWorker.swift @@ -51,8 +51,12 @@ struct AsyncSequenceWorkerWorkflow: Workflow { context.runSideEffect(key: state) { lifetime in let sequence = worker.run() let task = Task { @MainActor in - for try await output in sequence { - sink.send(AnyWorkflowAction(sendingOutput: output)) + do { + for try await output in sequence { + sink.send(AnyWorkflowAction(sendingOutput: output)) + } + } catch { + fatalError("AsyncSequenceWorker implementations should not throw errors on iteration: \(error)") } }