---
title: "replaceError(with:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/optional/publisher-swift.struct/replaceerror(with:)"
---

# replaceError(with:)

## Declaration

```swift
func replaceError(with output: Optional<Wrapped>.Publisher.Output) -> Optional<Optional<Wrapped>.Publisher.Output>.Publisher
```
