Skip to content

Commit d58ff5c

Browse files
SamsamBabadithilanga
authored andcommitted
Change HTTP Status Code on Validation ex (dingo#1532)
* Change HTTP Status Code on Validation ex ValidationException has status code for response but does not implement HttpExceptionInterface status code by default is 422 but can change in * Fixed StyleCI
1 parent d467926 commit d58ff5c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Exception/Handler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ protected function genericResponse(Exception $exception)
180180
*/
181181
protected function getStatusCode(Exception $exception)
182182
{
183+
if ($exception instanceof ValidationException) {
184+
return $exception->status;
185+
}
186+
183187
return $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500;
184188
}
185189

0 commit comments

Comments
 (0)