Registers a callback that will forward the failure reason to the event loop's error handler if the promise fails.

Use this function if you neither return the promise nor handle a possible error yourself to prevent errors from going entirely unnoticed.

Type Parameter Description Default Value
Amp\Promise|React\Promise\PromiseInterface $promise Promise to register the handler on. none