Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ParamConversionEnhancer.php

function ParamConversionEnhancer::onException

Catches failed parameter conversions and throw a 404 instead.

Parameters

\Symfony\Component\HttpKernel\Event\ExceptionEvent $event: The event.

File

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

Class

ParamConversionEnhancer
Provides a route enhancer that handles parameter conversion.

Namespace

Drupal\Core\Routing\Enhancer

Code

public function onException(ExceptionEvent $event) {
    $exception = $event->getThrowable();
    if ($exception instanceof ParamNotConvertedException) {
        $event->setThrowable(new NotFoundHttpException($exception->getMessage(), $exception));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal