Skip to content

Commit 7d71570

Browse files
committed
Allow synchronous fireAndForget to throw (#1092)
1 parent 8741cd9 commit 7d71570

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sources/ComposableArchitecture/Effect.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ extension Effect {
2121
}
2222

2323
/// Creates an effect that executes some work in the real world that doesn't need to feed data
24-
/// back into the store.
24+
/// back into the store. If an error is thrown, the effect will complete and the error will be ignored.
2525
///
2626
/// - Parameter work: A closure encapsulating some work to execute in the real world.
2727
/// - Returns: An effect.
28-
public static func fireAndForget(_ work: @escaping () -> Void) -> Effect {
28+
///
29+
/// - Parameter work: A closure encapsulating some work to execute in the real world.
30+
/// - Returns: An effect.
31+
public static func fireAndForget(_ work: @escaping () throws -> Void) -> Effect {
2932
.deferred { () -> SignalProducer<Value, Error> in
30-
work()
33+
try? work()
3134
return .empty
3235
}
3336
}

0 commit comments

Comments
 (0)