Catch API endpoint errors.

This commit is contained in:
James Cole
2025-01-26 07:44:41 +01:00
parent c204533195
commit 1c19428a12
13 changed files with 86 additions and 87 deletions

View File

@@ -38,6 +38,15 @@ class IsValidPositiveAmount implements ValidationRule
*/
public function validate(string $attribute, mixed $value, \Closure $fail): void
{
if(is_array($value)) {
$fail('validation.numeric')->translate();
$message = sprintf('IsValidPositiveAmount: "%s" is not a number.', json_encode($value));
Log::debug($message);
Log::channel('audit')->info($message);
return;
}
$value = (string) $value;
// must not be empty:
if ($this->emptyString($value)) {