You are here

protected static function DefaultExceptionSubscriber::getPriority in Drupal 9

Same name in this branch
  1. 9 core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php \Drupal\jsonapi\EventSubscriber\DefaultExceptionSubscriber::getPriority()
  2. 9 core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php \Drupal\serialization\EventSubscriber\DefaultExceptionSubscriber::getPriority()
Same name and namespace in other branches
  1. 8 core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php \Drupal\serialization\EventSubscriber\DefaultExceptionSubscriber::getPriority()
  2. 10 core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php \Drupal\serialization\EventSubscriber\DefaultExceptionSubscriber::getPriority()

Specifies the priority of all listeners in this class.

The default priority is 1, which is very low. To have listeners that have a "first attempt" at handling exceptions return a higher priority.

Return value

int The event priority of this subscriber.

Overrides HttpExceptionSubscriberBase::getPriority

1 call to DefaultExceptionSubscriber::getPriority()
DefaultExceptionSubscriber::getPriority in core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php
Specifies the priority of all listeners in this class.
1 method overrides DefaultExceptionSubscriber::getPriority()
DefaultExceptionSubscriber::getPriority in core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php
Specifies the priority of all listeners in this class.

File

core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php, line 54

Class

DefaultExceptionSubscriber
Handles default error responses in serialization formats.

Namespace

Drupal\serialization\EventSubscriber

Code

protected static function getPriority() {

  // This will fire after the most common HTML handler, since HTML requests
  // are still more common than HTTP requests. But it has a lower priority
  // than \Drupal\Core\EventSubscriber\ExceptionJsonSubscriber::on4xx(), so
  // that this also handles the 'json' format. Then all serialization formats
  // (::getHandledFormats()) are handled by this exception subscriber, which
  // results in better consistency.
  return -70;
}