ParamConversionEnhancer::onException

public ParamConversionEnhancer::onException(GetResponseForExceptionEvent $event)

Catches failed parameter conversions and throw a 404 instead.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event:

File

core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php, line 77

Class

ParamConversionEnhancer
Provides a route enhancer that handles parameter conversion.

Namespace

Drupal\Core\Routing\Enhancer

Code

public function onException(GetResponseForExceptionEvent $event) {
  $exception = $event->getException();
  if ($exception instanceof ParamNotConvertedException) {
    $event->setException(new NotFoundHttpException($exception->getMessage(), $exception));
  }
}
doc_Drupal
2016-10-29 09:33:07
Comments
Leave a Comment

Please login to continue.