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