File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public func withThrowingTimeout<T>(
81
81
private func _withThrowingTimeout< T> (
82
82
isolation: isolated ( any Actor ) ? = #isolation,
83
83
body: ( ) async throws -> sending T,
84
- timeout: @Sendable @escaping ( ) async throws -> Void
84
+ timeout: @Sendable @escaping ( ) async throws -> Never
85
85
) async throws -> Transferring < T > {
86
86
try await withoutActuallyEscaping ( body) { escapingBody in
87
87
let bodyTask = Task {
@@ -155,15 +155,14 @@ public func withThrowingTimeout<T>(
155
155
// Sendable
156
156
private func _withThrowingTimeout< T: Sendable > (
157
157
body: @Sendable @escaping ( ) async throws -> T ,
158
- timeout: @Sendable @escaping ( ) async throws -> Void
158
+ timeout: @Sendable @escaping ( ) async throws -> Never
159
159
) async throws -> T {
160
160
try await withThrowingTaskGroup ( of: T . self) { group in
161
161
group. addTask {
162
162
try await body ( )
163
163
}
164
164
group. addTask {
165
165
try await timeout ( )
166
- throw TimeoutError ( " expired " )
167
166
}
168
167
let success = try await group. next ( ) !
169
168
group. cancelAll ( )
You can’t perform that action at this time.
0 commit comments