Skip to content

Commit f8b7169

Browse files
committed
Add missing 'try' for throwing async code.
Fixes <rdar://97022479>
1 parent 8f62897 commit f8b7169

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ public func withTaskGroup<ChildTaskResult, GroupResult>(
9999
/// you can use a `for`-`await`-`in` loop:
100100
///
101101
/// var sum = 0
102-
/// for await result in group {
102+
/// for try await result in group {
103103
/// sum += result
104104
/// }
105105
///
106106
/// If you need more control or only a few results,
107107
/// you can call `next()` directly:
108108
///
109-
/// guard let first = await group.next() else {
109+
/// guard let first = try await group.next() else {
110110
/// group.cancelAll()
111111
/// return 0
112112
/// }
@@ -578,7 +578,7 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
578578
///
579579
/// You can also use a `for`-`await`-`in` loop to collect results of a task group:
580580
///
581-
/// for await try value in group {
581+
/// for try await value in group {
582582
/// collected += value
583583
/// }
584584
///

0 commit comments

Comments
 (0)