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

handle (Future method)

Last update:
May 18, 2026
Runs a handler on the completing thread that can produce a new value for both success and failure.

Description

Synchronous counterpart to handleAsync.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.handle(function)

Parameters

ParameterDescription
functionRequired. A function (value, error) that returns the next value.

See also

Example

Append a suffix on success.

<cfscript>
    future = runAsync(function() { return "success"; });
    handled = future.handle(function(value, error) {    return isNull(error) ? value & "_handled" : "error_handled";});
    writeOutput(handled.get()); // success_handled
</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