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
CancellationDeclaration
Swift
@discardableResult public func `catch`(on: Dispatcher = conf.D.return, policy: CatchPolicy = conf.catchPolicy, _ body: @escaping (Error) -> Void) -> CancellableFinalizerParameters
onThe queue to which the provided closure dispatches.
policyThe default policy does not execute your handler for cancellation errors.
executeThe 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
catchis 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 aCatchPolicyis unsupported. You can instead specify e.g. your cancellable error.See also
CancellationDeclaration
Swift
public func `catch`<E>(only: E, on: Dispatcher = conf.D.return, _ body: @escaping (E) -> Void) -> CancellableCascadingFinalizer where E : Equatable, E : ErrorParameters
onlyThe specific error to be caught and handled.
onThe queue to which the provided closure dispatches.
executeThe 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
catchis 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
CancellationDeclaration
Swift
public func `catch`<E>(only: E.Type, on: Dispatcher = conf.D.return, policy: CatchPolicy = conf.catchPolicy, _ body: @escaping (E) -> Void) -> CancellableCascadingFinalizer where E : ErrorParameters
onlyThe error type to be caught and handled.
onThe queue to which the provided closure dispatches.
executeThe handler to execute if this promise is rejected with the provided error type.
-
Consumes the Swift unused-result warning.
Note
You shouldcatch, but in situations where you know you don’t need acatch,cauterizemakes your intentions clear.Declaration
Swift
@discardableResult public func cauterize() -> CancellableFinalizer
View on GitHub
CancellableCascadingFinalizer Class Reference