whenFailure(_:)

Adds an observer callback to this EventLoopFuture that is called when the EventLoopFuture has a failure result.

EventLoopFuture.swift:881
@preconcurrency func whenFailure(_ callback: @escaping (any Error) -> Void)

Parameters

callback

The callback that is called with the failed result of the EventLoopFuture.

An observer callback cannot return a value, meaning that this function cannot be chained from. If you are attempting to create a computation pipeline, consider recover or flatMapError. If you find yourself passing the results from this EventLoopFuture to a new EventLoopPromise in the body of this function, consider using cascade instead.