Don't throw error, report it.

This commit is contained in:
James Cole
2025-11-04 20:48:58 +01:00
parent a3eb3bb1a4
commit 0bc2d40d9b
7 changed files with 61 additions and 18 deletions

View File

@@ -82,7 +82,7 @@ class ReportController extends Controller
public function auditReport(Collection $accounts, Carbon $start, Carbon $end)
{
if ($end < $start) {
return view('error')->with('message', (string) trans('firefly.end_after_start_date'));
return view('errors.error')->with('message', (string) trans('firefly.end_after_start_date'));
}
$this->repository->cleanupBudgets();
$start->endOfDay(); // end of day so the final balance is at the end of that day.
@@ -115,7 +115,7 @@ class ReportController extends Controller
public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
{
if ($end < $start) {
return view('error')->with('message', (string) trans('firefly.end_after_start_date'));
return view('errors.error')->with('message', (string) trans('firefly.end_after_start_date'));
}
$this->repository->cleanupBudgets();
$start->endOfDay(); // end of day so the final balance is at the end of that day.
@@ -149,7 +149,7 @@ class ReportController extends Controller
public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
{
if ($end < $start) {
return view('error')->with('message', (string) trans('firefly.end_after_start_date'));
return view('errors.error')->with('message', (string) trans('firefly.end_after_start_date'));
}
$this->repository->cleanupBudgets();
$start->endOfDay(); // end of day so the final balance is at the end of that day.
@@ -183,7 +183,7 @@ class ReportController extends Controller
public function defaultReport(Collection $accounts, Carbon $start, Carbon $end)
{
if ($end < $start) {
return view('error')->with('message', (string) trans('firefly.end_after_start_date'));
return view('errors.error')->with('message', (string) trans('firefly.end_after_start_date'));
}
$this->repository->cleanupBudgets();
@@ -336,7 +336,7 @@ class ReportController extends Controller
}
if ($request->getEndDate() < $request->getStartDate()) {
return view('error')->with('message', (string) trans('firefly.end_after_start_date'));
return view('errors.error')->with('message', (string) trans('firefly.end_after_start_date'));
}
$url = match ($reportType) {
@@ -361,7 +361,7 @@ class ReportController extends Controller
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
if ($end < $start) {
return view('error')->with('message', (string) trans('firefly.end_after_start_date'));
return view('errors.error')->with('message', (string) trans('firefly.end_after_start_date'));
}
$this->repository->cleanupBudgets();
$start->endOfDay(); // end of day so the final balance is at the end of that day.