Skip to content

Instantly share code, notes, and snippets.


jasdev/set_failure_type_setup.swift Secret

Last active Apr 7, 2020
What would you like to do?
`setFailureType` setup with `Just`.
import Combine
/// (1) A sample error type we’ll try to promote `Never` to.
enum OurError: Error {
case anError
Just(6_174) /// (2) [`Just<Int>.Failure == Never`](
.mapError { /* `(Never) -> OurError` */ } /// (3) This is…awkward. `mapError` accepts an `(Failure) -> E`
/// closure for some new `Error`-conforming type, `E`. But, this block is never executed since,
/// well, there aren’t any `Never` instances to call it with.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.