flatMapErrorThrowing(_:)

When the current EventLoopFuture<Value> is in an error state, run the provided callback, which may recover from the error and returns a new value of type Value. The provided callback may optionally throw, in which case the EventLoopFuture will be in a failed state with the new thrown error.

EventLoopFuture.swift:595
@preconcurrency func flatMapErrorThrowing(_ callback: @escaping (Error) throws -> Value) -> EventLoopFuture<Value>

Parameters

callback

Function that will receive the error value of this EventLoopFuture and return a new value lifted into a new EventLoopFuture.

Returns

A future that will receive the eventual value or a rethrown error.

Operations performed in flatMapErrorThrowing should not block, or they will block the entire event loop. flatMapErrorThrowing is intended for use when you have the ability to synchronously recover from errors.

If your callback function throws, the returned EventLoopFuture will error.