Skip to content

Commit 79e44ce

Browse files
Ignore errors thrown in fireAndForget. (#1088)
* Ignore errors throw in fireAndForget. * Update Sources/ComposableArchitecture/Effects/Concurrency.swift Co-authored-by: Stephen Celis <[email protected]> * Update Sources/ComposableArchitecture/Effects/Concurrency.swift Co-authored-by: Stephen Celis <[email protected]>
1 parent 07cd0c2 commit 79e44ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/ComposableArchitecture/Effects/Concurrency.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ import SwiftUI
104104
}
105105

106106
/// Creates an effect that executes some work in the real world that doesn't need to feed data
107-
/// back into the store.
107+
/// back into the store. If an error is thrown, the effect will complete and the error will be ignored.
108108
///
109109
/// - Parameters:
110110
/// - priority: Priority of the underlying task. If `nil`, the priority will come from
@@ -113,9 +113,9 @@ import SwiftUI
113113
/// - Returns: An effect.
114114
public static func fireAndForget(
115115
priority: TaskPriority? = nil,
116-
_ work: @escaping @Sendable () async -> Void
116+
_ work: @escaping @Sendable () async throws -> Void
117117
) -> Effect {
118-
Effect<Void, Never>.task(priority: priority) { await work() }
118+
Effect<Void, Never>.task(priority: priority) { try? await work() }
119119
.fireAndForget()
120120
}
121121
}

0 commit comments

Comments
 (0)