mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Fix various API 500 errors.
This commit is contained in:
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Exceptions;
|
||||
|
||||
use Brick\Math\Exception\NumberFormatException;
|
||||
use FireflyIII\Jobs\MailError;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
@@ -133,10 +134,10 @@ class Handler extends ExceptionHandler
|
||||
|
||||
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadHttpHeaderException'], $e->statusCode);
|
||||
}
|
||||
if($e instanceof ValidationException && $expectsJson) {
|
||||
if(($e instanceof ValidationException || $e instanceof NumberFormatException) && $expectsJson) {
|
||||
$errorCode = 422;
|
||||
return response()->json(
|
||||
['message' => sprintf('Validation exception: %s', $e->getMessage()), 'errors' => ['date' => 'Date is invalid']],
|
||||
['message' => sprintf('Validation exception: %s', $e->getMessage()), 'errors' => ['field' => 'Field is invalid']],
|
||||
$errorCode
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user