Contents

init(upstream:handler:)

Creates a publisher that handles errors from an upstream publisher by replacing the failed publisher with another publisher or by throwing an error.

Declaration

init(upstream: Upstream, handler: @escaping (Upstream.Failure) throws -> NewPublisher)

Parameters

  • upstream:

    The publisher from which this publisher receives its elements.

  • handler:

    A closure that accepts the upstream failure as input and either returns a publisher to replace the upstream publisher. If this closure throws an error, the publisher terminates with the thrown error.