Skip to content

Instance Method

future(error:)

Creates a new, failed EventLoopFuture from the worker’s event loop.
func future<T>(error: any Error) -> EventLoopFuture<T>

Parameters

error

The error that the future will wrap.

Return Value

The failed future.

Discussion

Let b: EvenLoopFuture = req.future(error: Abort(…))

See Also

EventLoop and EventLoopGroup

  • flatten(_:)
    Returns a new EventLoopFuture that succeeds only when all the provided futures succeed. The new EventLoopFuture contains an array of results, maintaining same ordering as the futures.
  • flatten(_:)
    Returns a new EventLoopFuture that succeeds only when all the provided futures succeed, ignoring the resolved values.
  • future()
    Creates a new, succeeded EventLoopFuture from the worker’s event loop with a Void value.
  • future(_:)
    Creates a new, succeeded EventLoopFuture from the worker’s event loop.
  • future(result:)
    Creates a new Future from the worker’s event loop, succeeded or failed based on the input Result.
  • tryFuture(_:)
    An alternate name for this would be future(catching:), but with that name, trailing closure syntax just looks like el.future { ... }, which does not indicate to readers of the code that it is the error-capturing version. Since such an indication is highly desirable, a slightly less idiomatic name is used instead.