mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Catch value error.
This commit is contained in:
parent
b894bffad9
commit
ad8a8ae612
@ -36,6 +36,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use Log;
|
||||
use ValueError;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -244,7 +245,14 @@ class AvailableBudgetController extends Controller
|
||||
|
||||
return redirect(route('budgets.index', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||
}
|
||||
if (bccomp($amount, '0') <= 0) {
|
||||
try {
|
||||
if (bccomp($amount, '0') <= 0) {
|
||||
session()->flash('error', trans('firefly.invalid_amount'));
|
||||
|
||||
return redirect(route('budgets.index', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||
}
|
||||
} catch (ValueError $e) {
|
||||
Log::error(sprintf('Value "%s" is not a number: %s', $amount, $e->getMessage()));
|
||||
session()->flash('error', trans('firefly.invalid_amount'));
|
||||
|
||||
return redirect(route('budgets.index', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||
|
Loading…
Reference in New Issue
Block a user