Handles errors from an upstream publisher by replacing it with another publisher.
- iOS 13.0+Beta
- macOS 10.15+Beta
- Mac Catalyst 13.0+Beta
- tvOS 13.0+Beta
- watchOS 6.0+Beta
- Xcode 11.0+Beta
A closure that accepts the upstream failure as input and returns a publisher to replace the upstream publisher.
A publisher that handles errors from an upstream publisher by replacing the failed publisher with another publisher.
The following example replaces any error from the upstream publisher and replaces the upstream with a
Just publisher. This continues the stream by publishing a single value and completing normally.
Backpressure note: This publisher passes through
cancel to the upstream. After receiving an error, the publisher sends sends any unfulfilled demand to the new