public static function ExceptionController::getExceptionListener

Instantiates a new exception listener.

Factory method for getting an Exception Listener. Since this needs to be instanciated with a controller callable, i.e. an ExceptionConroller object and the name of the method to call, we can't just register it to the DIC the regular way.

@todo This probably doesn't belong here, but I'm not sure where would be a better place to put it... in a class of its own?

File

drupal/core/lib/Drupal/Core/ExceptionController.php, line 41
Definition of Drupal\Core\ExceptionController.

Class

ExceptionController
This controller handles HTTP errors generated by the routing system.

Namespace

Drupal\Core

Code

public static function getExceptionListener(Container $container) {
  $negotiation = $container
    ->get('content_negotiation');
  $exceptionController = new self($negotiation);
  $exceptionController
    ->setContainer($container);
  return new ExceptionListener(array(
    $exceptionController,
    'execute',
  ));
}