From 4016c99cfb45a87655fcb459ae44881024fec20c Mon Sep 17 00:00:00 2001 From: Maxcastel Date: Thu, 5 Nov 2026 10:56:36 +0100 Subject: [PATCH] fix(laravel): return 400 for invalid IRIs and serializer errors --- core/configuration.md | 6 +++++- core/errors.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/configuration.md b/core/configuration.md index cfab99b2e34..a7be08eb722 100644 --- a/core/configuration.md +++ b/core/configuration.md @@ -392,9 +392,11 @@ default values: ```php [ AuthenticationException::class => 401, - AuthorizationException::class => 403 + AuthorizationException::class => 403, + SerializerExceptionInterface::class => 400, + InvalidArgumentException::class => 400, ], // The list of routes. diff --git a/core/errors.md b/core/errors.md index c77db00c53f..2e78bd3653a 100644 --- a/core/errors.md +++ b/core/errors.md @@ -62,6 +62,8 @@ And like this, if you are using API Platform with Laravel: 4. Similarly, check for `App\Contracts\Exceptions\HttpExceptionInterface`. 5. Use defaults for the following exceptions: - `Illuminate\Http\Exceptions\HttpResponseException` => 400 + - `Symfony\Component\Serializer\Exception\ExceptionInterface` => 400 + - `ApiPlatform\Metadata\Exception\InvalidArgumentException` => 400 - `ApiPlatform\Symfony\Validator\Exception\ValidationException` => 422 6. The status defined on an `ErrorResource` 7. Fallback to 500.