Pike v8.0 release 1738

Method Concurrent.Future()->recover()


Method recover

this_program recover(function(mixed, mixed ... :mixed) fun, mixed ... extra)

Description

This specifies a callback that is only called on failure, and allows you to alter the future into a success.

Parameter fun

Function to be called. The first argument will be the failure result of this Future. The return value will be the success result of the new Future.

Parameter extra

Any extra context needed for fun. They will be provided as arguments two and onwards when the callback is called.

Returns

The new Future.

Note

This method is used if your callbacks return a regular value (i.e. not a Future).

See also

recover_with(), map(), transform()