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

# init(upstream:transform:)

Creates a publisher that converts any failure from the upstream publisher into a new error.

## Declaration

```swift
init(upstream: Upstream, transform: @escaping (Upstream.Failure) -> Failure)
```

## Parameters

- `upstream`: The publisher from which this publisher receives elements.
- `transform`: The closure that converts the upstream failure into a new error.

## See Also

### Creating an error-mapping publisher

- [init(upstream:_:)](combine/publishers/maperror/init(upstream:_:).md)
