Whatever message this page gives is out now! Go check it out!
future.exceptionallyComposeAsync(function)| Parameter | Description |
|---|---|
| function | Required. A function that takes the exception and returns a Future for recovery. |
<cfscript>
future = runAsync(function() { throw("error"); });
sleep(200);
recovered = future.exceptionallyComposeAsync(function(error) { return runAsync(function() { return "recovered_async"; });});
writeOutput(recovered.get()); // recovered_async
// Chained recovery when inner recovery fails:
future2 = runAsync(function() { throw("first error"); });
sleep(200);
recovered2 = future2 .exceptionallyComposeAsync(function(error) { return runAsync(function() { throw("second error"); }); }) .exceptionallyComposeAsync(function(error) { return runAsync(function() { return "final_recovery"; }); });
writeOutput(recovered2.get()); // final_recovery
</cfscript>