<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine/Publishers/ReplaceError",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine10PublishersO12ReplaceErrorV"
  },
  "title" : "Publishers.ReplaceError"
}
-->

# Publishers.ReplaceError

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

```
struct ReplaceError<Upstream> where Upstream : Publisher
```

## Topics

### Creating a replace error Publisher

[`init(upstream:output:)`](/documentation/Combine/Publishers/ReplaceError/init(upstream:output:))

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

### Declaring supporting types

[`Publishers.ReplaceError.Output`](/documentation/Combine/Publishers/ReplaceError/Output-swift.typealias)

The kind of values published by this publisher.

[`Publishers.ReplaceError.Output`](/documentation/Combine/Publishers/ReplaceError/Output-swift.typealias)

The kind of values published by this publisher.

[`Publishers.ReplaceError.Failure`](/documentation/Combine/Publishers/ReplaceError/Failure)

The kind of errors this publisher might publish.

### Inspecting publisher properties

[`upstream`](/documentation/Combine/Publishers/ReplaceError/upstream)

The publisher from which this publisher receives elements.

[`output`](/documentation/Combine/Publishers/ReplaceError/output-swift.property)

The element with which to replace errors from the upstream publisher.

[`output`](/documentation/Combine/Publishers/ReplaceError/output-swift.property)

The element with which to replace errors from the upstream publisher.

### Comparing publishers

[`==(_:_:)`](/documentation/Combine/Publishers/ReplaceError/==(_:_:))

Returns a Boolean value that indicates whether two publishers are equivalent.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)