Method Concurrent.Future()->thencatch()


Method thencatch

local this_program thencatch(function(mixed, __unknown__ ... :mixed) onrejected, mixed ... extra)

Description

JavaScript Promise API equivalent of a combination of recover() and recover_with().

Parameter onrejected

Function to be called. The first argument will be the failure result of this Future. The return value will the failure result of the new Future. If the return value already is a Future, pass it as-is.

Parameter extra

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

Returns

The new Future.

See also

recover(), recover_with(), then(), on_failure(), Promise.failure(), https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise