function ParamConversionEnhancer::onException
Same name in other branches
- 9 core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php \Drupal\Core\Routing\Enhancer\ParamConversionEnhancer::onException()
- 10 core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php \Drupal\Core\Routing\Enhancer\ParamConversionEnhancer::onException()
- 11.x core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php \Drupal\Core\Routing\Enhancer\ParamConversionEnhancer::onException()
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\EnhancerCode
public function onException(GetResponseForExceptionEvent $event) {
$exception = $event->getException();
if ($exception instanceof ParamNotConvertedException) {
$event->setException(new NotFoundHttpException($exception->getMessage(), $exception));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.