Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Don't throw error, report it.
James Cole0bc2d40d9b01
diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.phpindex 2741d94812..6e7e573e98 100644--- a/app/Http/Controllers/AttachmentController.php+++ b/app/Http/Controllers/AttachmentController.php@@ -95,7 +95,7 @@ class AttachmentController extends Controller/*** Download attachment to PC.*- * @return LaravelResponse+ * @return LaravelResponse|View** @throws FireflyException*/@@ -121,8 +121,8 @@ class AttachmentController extends Controllerreturn $response;}-- throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');+ $message = 'Could not find the indicated attachment. The file is no longer there.';+ return view('errors.error', compact('message'));}/**@@ -194,7 +194,7 @@ class AttachmentController extends Controller** @throws FireflyException*/- public function view(Attachment $attachment): LaravelResponse+ public function view(Attachment $attachment): LaravelResponse|View{if ($this->repository->exists($attachment)) {$content = $this->repository->getContent($attachment);@@ -223,6 +223,7 @@ class AttachmentController extends Controller);}- throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');+ $message = 'Could not find the indicated attachment. The file is no longer there.';+ return view('errors.error', compact('message'));}}diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.phpindex a945fc7879..d3f996c6f4 100644--- a/app/Http/Controllers/Auth/ForgotPasswordController.php+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php@@ -73,7 +73,7 @@ class ForgotPasswordController extends Controller$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));Log::error($message);- return view('error', compact('message'));+ return view('errors.error', compact('message'));}// validate host header.@@ -138,7 +138,7 @@ class ForgotPasswordController extends Controllerif ('web' !== config('firefly.authentication_guard')) {$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));- return view('error', compact('message'));+ return view('errors.error', compact('message'));}// is allowed to?diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.phpindex a36e65e8bc..ea1e8619f1 100644--- a/app/Http/Controllers/Auth/RegisterController.php+++ b/app/Http/Controllers/Auth/RegisterController.php@@ -158,12 +158,12 @@ class RegisterController extends Controllerif (true === $allowRegistration) {$message = 'You do not need an invite code on this installation.';- return view('error', compact('message'));+ return view('errors.error', compact('message'));}if (false === $validCode) {$message = 'Invalid code.';- return view('error', compact('message'));+ return view('errors.error', compact('message'));}$email = $request->old('email');@@ -189,7 +189,7 @@ class RegisterController extends Controllerif (false === $allowRegistration) {$message = 'Registration is currently not available. If you are the administrator, you can enable this in the administration.';- return view('error', compact('message'));+ return view('errors.error', compact('message'));}$email = $request?->old('email');diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.phpindex 714d98bf32..b52ae8e0e7 100644--- a/app/Http/Controllers/Auth/ResetPasswordController.php+++ b/app/Http/Controllers/Auth/ResetPasswordController.php@@ -80,7 +80,7 @@ class ResetPasswordController extends Controllerif ('web' !== config('firefly.authentication_guard')) {$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));- return view('error', compact('message'));+ return view('errors.error', compact('message'));}$rules = [@@ -127,7 +127,7 @@ class ResetPasswordController extends Controllerif ('web' !== config('firefly.authentication_guard')) {$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));- return view('error', compact('message'));+ return view('errors.error', compact('message'));}// is allowed to register?diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.phpindex eb82e859d9..46506681d6 100644--- a/app/Http/Controllers/ReportController.php+++ b/app/Http/Controllers/ReportController.php@@ -82,7 +82,7 @@ class ReportController extends Controllerpublic 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 Controllerpublic 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 Controllerpublic 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 Controllerpublic 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 Controllerpublic 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.diff --git a/resources/views/error.twig b/resources/views/error-old.twigsimilarity index 100%rename from resources/views/error.twigrename to resources/views/error-old.twigdiff --git a/resources/views/errors/error.blade.php b/resources/views/errors/error.blade.phpnew file mode 100644index 0000000000..12a061bfce--- /dev/null+++ b/resources/views/errors/error.blade.php@@ -0,0 +1,42 @@+@extends('layout.v2.error')+@section('status_code','')+@section('status','Error message')+@section('sub_title', trans('errors.error_occurred'))+@section('content')+ <div class="row">+ <div class="col">+ <p>+ {{ trans('errors.error_not_recoverable') }}+ </p>+ <p class="text-danger">+ {{ $message }}+ </p>+ </div>+ </div>+ <div class="row">+ <div class="col">+ <h4>+ {{ trans('errors.more_info') }}+ </h4>+ <p>+ {!! trans('errors.collect_info') !!}+ {!! trans('errors.collect_info_more') !!}+ </p>+ <h4>+ {{ trans('errors.github_help') }}+ </h4>+ <p>+ {!! trans('errors.github_instructions') !!}+ </p>+ <ol>+ <li>{{ trans('errors.use_search') }}</li>+ <li>{!! trans('errors.include_info', ['link' => route('debug') ]) !!}</li>+ <li>{{ trans('errors.tell_more') }}</li>+ <li>{{ trans('errors.include_logs') }}</li>+ <li>{{ trans('errors.what_did_you_do') }}</li>+ </ol>+ </div>+ </div>+@endsection++