Instance Method

replaceError(with:)

Replaces any errors in the stream with the provided element.

Declaration

func replaceError(with output: Never) -> Publishers.ReplaceError<Publishers.IgnoreOutput<Upstream>>

Parameters

output

An element to emit when the upstream publisher fails.

Return Value

A publisher that replaces an error from the upstream publisher with the provided output element.

Discussion

If the upstream publisher fails with an error, this publisher emits the provided element, then finishes normally.