Skip to content

[docs] Fix cut off sentence and correct Throwing discarding task group docs #68791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions stdlib/public/Concurrency/DiscardingTaskGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,25 @@ extension DiscardingTaskGroup: Sendable { }
/// }
/// ```
///
/// Generally, this suits the typical use cases of a
/// discarding task group well, however, if you want to prevent specific
/// errors from canceling the group you can catch them inside the child
/// task's body like this:
///
///
/// Generally, this suits the typical use-cases of a
/// discarding task group well, however, if you wanted to prevent specific
/// errors from cancelling the group
///
///
///
///
/// Throwing an error in one of the child tasks of a task group
/// doesn't immediately cancel the other tasks in that group.
/// However,
/// throwing out of the `body` of the `withThrowingTaskGroup` method does cancel
/// the group, and all of its child tasks.
/// ```
/// try await withThrowingDiscardingTaskGroup { group in
/// group.addTask {
/// do {
/// try boom(1)
/// } catch is HarmlessError {
/// return
/// }
/// }
/// group.addTask {
/// try boom(2, after: .seconds(5))
/// }
/// }
/// ```
@available(SwiftStdlib 5.9, *)
@inlinable
@_unsafeInheritExecutor
Expand Down