CombineErgonomics Documentation

Class Promise​Finalizer

public class PromiseFinalizer<P: Publisher, S: Scheduler>  

This class helps provide a UX similar to using PromiseKit promises, but with Combine Publishers.

Methods

`catch`(_:​)

@discardableResult
    public func `catch`(_ handler: @escaping (P.Failure) -> Void) -> PromiseFinalizer<P, S>  

Attach a closure to handle the error arising from a publisher. This closure will run on DispatchQueue.main

Parameters

handler @escaping (P.​Failure) -> Void

the closure to execute on failure

Returns

PromiseFinalizer that can receive a finally block

cauterize()

public func cauterize()  

Deliberately ends the future chain, swallowing any errors along the way.

finally(_:​)

public func finally(_ handler: @escaping () -> Void)  

Use this method to execute a closure after the chain has completed

Parameters

handler @escaping () -> Void

The closure to execute after the chain has completed