function Promise::catch
@template TThrowable of \Throwable @template TRejected
Parameters
callable(TThrowable): (PromiseInterface<TRejected>|TRejected) $onRejected:
Return value
PromiseInterface<T|TRejected>
Overrides PromiseInterface::catch
1 call to Promise::catch()
- Promise::otherwise in vendor/
react/ promise/ src/ Promise.php
File
-
vendor/
react/ promise/ src/ Promise.php, line 83
Class
- Promise
- @template T @template-implements PromiseInterface<T>
Namespace
React\PromiseCode
public function catch(callable $onRejected) : PromiseInterface {
return $this->then(null, static function (\Throwable $reason) use ($onRejected) {
if (!_checkTypehint($onRejected, $reason)) {
return new RejectedPromise($reason);
}
/**
* @var callable(\Throwable):(PromiseInterface<TRejected>|TRejected) $onRejected
*/
return $onRejected($reason);
});
}