mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-15 19:09:50 +00:00
Catch API endpoint errors.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user