ExceptionJsonSubscriber::on400

public ExceptionJsonSubscriber::on400(GetResponseForExceptionEvent $event)

Handles a 400 error for JSON.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.

File

core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php, line 36

Class

ExceptionJsonSubscriber
Default handling for JSON errors.

Namespace

Drupal\Core\EventSubscriber

Code

public function on400(GetResponseForExceptionEvent $event) {
  $response = new JsonResponse(array('message' => $event->getException()->getMessage()), Response::HTTP_BAD_REQUEST);
  $event->setResponse($response);
}
doc_Drupal
2016-10-29 09:09:21
Comments
Leave a Comment

Please login to continue.