<!--
{
  "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/SetFailureType",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine10PublishersO14SetFailureTypeV"
  },
  "title" : "Publishers.SetFailureType"
}
-->

# Publishers.SetFailureType

A publisher that appears to send a specified failure type.

```
struct SetFailureType<Upstream, Failure> where Upstream : Publisher, Failure : Error, Upstream.Failure == Never
```

## Overview

The publisher can’t actually fail with the specified type and finishes normally. Use this publisher type when you need to match the error types for two mismatched publishers.

## Topics

### Creating a set failure type publisher

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

Creates a publisher that appears to send a specified failure type.

### Setting failure type

[`setFailureType(to:)`](/documentation/Combine/Publishers/SetFailureType/setFailureType(to:))

Changes the failure type declared by the upstream publisher.

### Declaring supporting types

[`Publishers.SetFailureType.Output`](/documentation/Combine/Publishers/SetFailureType/Output)

The kind of values published by this publisher.

### Inspecting publisher properties

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

The publisher from which this publisher receives elements.

### Comparing publishers

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

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)