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

# init(upstream:output:)

Creates a publisher that replaces any errors in the stream with a provided element.

## Declaration

```swift
init(upstream: Upstream, output: Publishers.ReplaceError<Upstream>.Output)
```

## Parameters

- `upstream`: The element with which to replace errors from the upstream publisher.
- `output`: The publisher from which this publisher receives elements.
