Fix endpoints, validate dates.

This commit is contained in:
James Cole
2025-01-25 09:17:21 +01:00
parent 949d818bad
commit 6d89485792
8 changed files with 28 additions and 5 deletions

View File

@@ -133,6 +133,13 @@ class Handler extends ExceptionHandler
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadHttpHeaderException'], $e->statusCode);
}
if($e instanceof ValidationException && $expectsJson) {
$errorCode = 422;
return response()->json(
['message' => sprintf('Validation exception: %s', $e->getMessage()), 'errors' => ['date' => 'Date is invalid']],
$errorCode
);
}
if ($expectsJson) {
$errorCode = 500;