public ExceptionJsonSubscriber::on404(GetResponseForExceptionEvent $event)
Handles a 404 error for JSON.
Parameters
\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.
File
- core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php, line 58
Class
- ExceptionJsonSubscriber
- Default handling for JSON errors.
Namespace
Drupal\Core\EventSubscriber
Code
public function on404(GetResponseForExceptionEvent $event) { $response = new JsonResponse(array('message' => $event->getException()->getMessage()), Response::HTTP_NOT_FOUND); $event->setResponse($response); }
Please login to continue.