diff --git a/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php b/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php index ba91836..5aec1b6 100644 --- a/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php +++ b/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php @@ -55,74 +55,15 @@ protected static function getPriority() { return -75; } - /** - * Handles a 400 error for HTTP. - * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event - * The event to process. - */ - public function on400(GetResponseForExceptionEvent $event) { - $this->setEventResponse($event, Response::HTTP_BAD_REQUEST); - } - - /** - * Handles a 403 error for HTTP. - * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event - * The event to process. - */ - public function on403(GetResponseForExceptionEvent $event) { - $this->setEventResponse($event, Response::HTTP_FORBIDDEN); - } /** - * Handles a 404 error for HTTP. + * Handles all 4xx errors for all serialization failures. * * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event * The event to process. */ - public function on404(GetResponseForExceptionEvent $event) { - $this->setEventResponse($event, Response::HTTP_NOT_FOUND); - } - - /** - * Handles a 405 error for HTTP. - * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event - * The event to process. - */ - public function on405(GetResponseForExceptionEvent $event) { - $this->setEventResponse($event, Response::HTTP_METHOD_NOT_ALLOWED); - } - - /** - * Handles a 406 error for HTTP. - * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event - * The event to process. - */ - public function on406(GetResponseForExceptionEvent $event) { - $this->setEventResponse($event, Response::HTTP_NOT_ACCEPTABLE); - } - - /** - * Handles a 422 error for HTTP. - * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event - * The event to process. - */ - public function on422(GetResponseForExceptionEvent $event) { - $this->setEventResponse($event, Response::HTTP_UNPROCESSABLE_ENTITY); - } - - /** - * Handles a 429 error for HTTP. - * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event - * The event to process. - */ - public function on429(GetResponseForExceptionEvent $event) { - $this->setEventResponse($event, Response::HTTP_TOO_MANY_REQUESTS); + public function on4xx(GetResponseForExceptionEvent $event) { + $this->setEventResponse($event, Response::HTTP_BAD_REQUEST); } /**