diff --git a/Examples/CaseStudies/SwiftUICaseStudies/03-Effects-WebSocket.swift b/Examples/CaseStudies/SwiftUICaseStudies/03-Effects-WebSocket.swift index fecec9d3c06b..3956fe5ea41f 100644 --- a/Examples/CaseStudies/SwiftUICaseStudies/03-Effects-WebSocket.swift +++ b/Examples/CaseStudies/SwiftUICaseStudies/03-Effects-WebSocket.swift @@ -300,7 +300,12 @@ extension WebSocketClient: DependencyKey { return AsyncStream { continuation in let task = Task { while !Task.isCancelled { - continuation.yield(await Result { try await Message(socket.receive()) }) + do { + let socketMessage = try await Message(socket.receive()) + continuation.yield(.success(socketMessage)) + } catch { + continuation.yield(.failure(error)) + } } continuation.finish() }