File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Sources/ComposableArchitecture Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -152,12 +152,14 @@ extension Effect {
152
152
/// ```
153
153
///
154
154
/// - Parameters:
155
- /// - f : A mapping function that converts `Result<Output,Failure >` to another type.
155
+ /// - transform : A mapping function that converts `Result<Value,Error >` to another type.
156
156
/// - Returns: An effect that wraps `self`.
157
- public func catchToEffect< T> ( _ f: @escaping ( Result < Value , Error > ) -> T ) -> Effect < T , Never > {
157
+ public func catchToEffect< T> (
158
+ _ transform: @escaping ( Result < Value , Error > ) -> T
159
+ ) -> Effect < T , Never > {
158
160
self
159
- . catchToEffect ( )
160
- . map ( f )
161
+ . map { transform ( . success ( $0 ) ) }
162
+ . flatMapError { Effect < T , Never > ( value : transform ( . failure ( $0 ) ) ) }
161
163
}
162
164
163
165
/// Turns any publisher into an ``Effect`` for any output and failure type by ignoring all output
You can’t perform that action at this time.
0 commit comments