PMKCascadingFinalizer

public class PMKCascadingFinalizer
extension PMKCascadingFinalizer: _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) -> PMKFinalizer

    Parameters

    on

    The dispatcher that executes the provided closure.

    policy

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

    body

    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.

    See also

    Cancellation

    Declaration

    Swift

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

    Parameters

    only

    The specific error to be caught and handled (e.g., PMKError.emptySequence).

    on

    The dispatcher that executes the provided closure.

    body

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

    Return Value

    A promise finalizer that accepts additional catch clauses.

  • 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) -> PMKCascadingFinalizer where E : Error

    Parameters

    only

    The error type to be caught and handled (e.g., PMKError).

    on

    The dispatcher that executes the provided closure.

    body

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

    Return Value

    A promise finalizer that accepts additional catch clauses.

  • 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() -> PMKFinalizer