flatMapThrowing(_:)

When the current EventLoopFuture<Value> is fulfilled, run the provided callback, which performs a synchronous computation and returns a new value of type NewValue. The provided callback may optionally throw.

EventLoopFuture.swift:561
@preconcurrency func flatMapThrowing<NewValue>(_ callback: @escaping (Value) throws -> NewValue) -> EventLoopFuture<NewValue>

Parameters

callback

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

Returns

A future that will receive the eventual value.

Operations performed in flatMapThrowing should not block, or they will block the entire event loop. flatMapThrowing is intended for use when you have a data-driven function that performs a simple data transformation that can potentially error.

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