Skip to content

Commit 119fed1

Browse files
committed
fix(laravel): InvalidUriVariableException status code (e400)
1 parent b0ee9f3 commit 119fed1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Laravel/Exception/ErrorHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use ApiPlatform\Laravel\ApiResource\Error;
1717
use ApiPlatform\Laravel\Controller\ApiPlatformController;
18+
use ApiPlatform\Metadata\Exception\InvalidUriVariableException;
1819
use ApiPlatform\Metadata\Exception\ProblemExceptionInterface;
1920
use ApiPlatform\Metadata\Exception\StatusAwareExceptionInterface;
2021
use ApiPlatform\Metadata\HttpOperation;
@@ -192,7 +193,7 @@ private function getStatusCode(?HttpOperation $apiOperation, ?HttpOperation $err
192193
return $exception->getStatusCode();
193194
}
194195

195-
if ($exception instanceof RequestExceptionInterface) {
196+
if ($exception instanceof RequestExceptionInterface || $exception instanceof InvalidUriVariableException) {
196197
return 400;
197198
}
198199

0 commit comments

Comments
 (0)