Whatever message this page gives is out now! Go check it out!

exceptionallyAsync (Future method)

Last update:
May 18, 2026
If this Future fails, runs a recovery function on the async executor that returns a substitute value. If it succeeds, the value passes through unchanged.

Description

exceptionallyAsync only handles the failure path. On success, your recovery function is not used.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.exceptionallyAsync(function)

Parameters

ParameterDescription
functionRequired. A function that takes the exception and returns a recovery value.

See also

Example

Return a fallback when the first stage throws (from product tests).

<cfscript>
    future = runAsync(function() { throw("error"); });
    sleep(200);
    recovered = future.exceptionallyAsync(function(error) {    return "fallback_value";});
    writeOutput(recovered.get()); // fallback_value
</cfscript>
      

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page