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

Breadcrumb

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

function PromiseInterface::catch

Registers a rejection handler for promise. It is a shortcut for:

```php $promise->then(null, $onRejected); ```

Additionally, you can type hint the `$reason` argument of `$onRejected` to catch only specific errors.

@template TThrowable of \Throwable @template TRejected

Parameters

callable(TThrowable): (PromiseInterface<TRejected>|TRejected) $onRejected:

Return value

PromiseInterface<T|TRejected>

3 methods override PromiseInterface::catch()
FulfilledPromise::catch in vendor/react/promise/src/Internal/FulfilledPromise.php
Registers a rejection handler for promise. It is a shortcut for:
Promise::catch in vendor/react/promise/src/Promise.php
@template TThrowable of \Throwable @template TRejected
RejectedPromise::catch in vendor/react/promise/src/Internal/RejectedPromise.php
@template TThrowable of \Throwable @template TRejected

File

vendor/react/promise/src/PromiseInterface.php, line 57

Class

PromiseInterface
@template-covariant T

Namespace

React\Promise

Code

public function catch(callable $onRejected) : PromiseInterface;

API Navigation

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