/** * Capture response from exception event and change it from configuration * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event * @return */ public function onKernelException(GetResponseForExceptionEvent $event) { if ($event->isPropagationStopped() || !$this->activated) { return; } $request = $event->getRequest(); $exception = $event->getException(); $response = $this->getAdaptedExceptionResponse($exception); if ($template = $this->isRegisteredEventRequest($request, $response->getStatusCode())) { $decoratedResponse = $this->createDecoratedExceptionResponse($request, $exception, $template); $response->setContent($decoratedResponse->getContent()); $event->setResponse($response); } return; }