Throw ValidationFailedException with per-field codes for 422 responses

This commit is contained in:
envoyr committed 2026-11-07 00:33:38 +00:00
1 parent a117a6a3c9
commit d458d5d7fc
4 files changed
+119 -2

No files matched your search

+5
View File
@@ -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,