mirror of
https://github.com/anikeen-com/id.git
synced 2026-11-07 16:18:33 +00:00
Throw ValidationFailedException with per-field codes for 422 responses
This commit is contained in:
4 files changed
+119
-2
No files matched your search
@@ -35,6 +35,11 @@ class ApiException extends ResourceException
|
||||
return PreconditionFailedException::fromResult($result);
|
||||
}
|
||||
|
||||
// refused input, with per-field codes on some endpoints
|
||||
if ($status === 422 && static::class === self::class) {
|
||||
return ValidationFailedException::fromResult($result);
|
||||
}
|
||||
|
||||
return new static(
|
||||
rtrim((string) ($body->message ?? $result->error()), '.'),
|
||||
$status,
|
||||
|
||||
Reference in new issue
Block a user