Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Promise.php

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\Promise

Code

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);
    });
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal