Contao\CoreBundle\EventListener\ResponseExceptionListener::onKernelException PHP Метод

onKernelException() публичный Метод

Sets the response from the exception.
public onKernelException ( GetResponseForExceptionEvent $event )
$event Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent
    public function onKernelException(GetResponseForExceptionEvent $event)
    {
        $exception = $event->getException();
        if (!$exception instanceof ResponseException) {
            return;
        }
        $event->setResponse($exception->getResponse());
    }

Usage Example

 /**
  * Tests passing a non-response exception.
  */
 public function testNonResponseException()
 {
     $event = new GetResponseForExceptionEvent($this->mockKernel(), new Request(), HttpKernelInterface::MASTER_REQUEST, new \RuntimeException());
     $listener = new ResponseExceptionListener();
     $listener->onKernelException($event);
     $this->assertFalse($event->hasResponse());
 }
ResponseExceptionListener