public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null)
{
if (null === $onCancel) {
return $this;
}
try {
return Promise::doResolve($onCancel($this->getReason()))->then(function () {
return Promise::doCancel($this->getReason());
}, function () {
return Promise::doCancel($this->getReason());
});
} catch (Error $ex) {
} catch (Exception $ex) {
}
return Promise::doCancel($this->getReason());
}