CancellableCascadingFinalizer

public class CancellableCascadingFinalizer : CancelContextFinalizer
extension CancellableCascadingFinalizer: _PMKCatchWrappers

Undocumented

  • The provided closure executes when this promise rejects.

    Rejecting a promise cascades: rejecting all subsequent promises (unless recover is invoked) thus you will typically place your catch at the end of a chain. Often utility promises will not have a catch, instead delegating the error handling to the caller.

    See also

    Cancellation

    Declaration

    Swift

    @discardableResult
    public func `catch`(on: Dispatcher = conf.D.return, policy: CatchPolicy = conf.catchPolicy, _ body: @escaping (Error) -> Void) -> CancellableFinalizer

    Parameters

    on

    The queue to which the provided closure dispatches.

    policy

    The default policy does not execute your handler for cancellation errors.

    execute

    The handler to execute if this promise is rejected.

    Return Value

    A promise finalizer.

  • The provided closure executes when this promise rejects with the specific error passed in. A final catch is still required at the end of the chain.

    Rejecting a promise cascades: rejecting all subsequent promises (unless recover is invoked) thus you will typically place your catch at the end of a chain. Often utility promises will not have a catch, instead delegating the error handling to the caller.

    Note

    Since this method handles only specific errors, supplying a CatchPolicy is unsupported. You can instead specify e.g. your cancellable error.

    See also

    Cancellation

    Declaration

    Swift

    public func `catch`<E>(only: E, on: Dispatcher = conf.D.return, _ body: @escaping (E) -> Void) -> CancellableCascadingFinalizer where E : Equatable, E : Error

    Parameters

    only

    The specific error to be caught and handled.

    on

    The queue to which the provided closure dispatches.

    execute

    The handler to execute if this promise is rejected with the provided error.

  • The provided closure executes when this promise rejects with an error of the type passed in. A final catch is still required at the end of the chain.

    Rejecting a promise cascades: rejecting all subsequent promises (unless recover is invoked) thus you will typically place your catch at the end of a chain. Often utility promises will not have a catch, instead delegating the error handling to the caller.

    See also

    Cancellation

    Declaration

    Swift

    public func `catch`<E>(only: E.Type, on: Dispatcher = conf.D.return, policy: CatchPolicy = conf.catchPolicy, _ body: @escaping (E) -> Void) -> CancellableCascadingFinalizer where E : Error

    Parameters

    only

    The error type to be caught and handled.

    on

    The queue to which the provided closure dispatches.

    execute

    The handler to execute if this promise is rejected with the provided error type.

  • Consumes the Swift unused-result warning.

    Note

    You should catch, but in situations where you know you don’t need a catch, cauterize makes your intentions clear.

    Declaration

    Swift

    @discardableResult
    public func cauterize() -> CancellableFinalizer