---
title: "init(upstream:handler:)"
framework: combine
role: symbol
role_heading: Initializer
path: "combine/publishers/catch/init(upstream:handler:)"
---

# init(upstream:handler:)

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

## Declaration

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

## Parameters

- `upstream`: The publisher from which this publisher receives its elements.
- `handler`: A closure that accepts the upstream failure as input and returns a publisher to replace the upstream publisher.
