mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-11 20:28:14 +00:00
Don't throw error, report it.
This commit is contained in:
@@ -95,7 +95,7 @@ class AttachmentController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Download attachment to PC.
|
* Download attachment to PC.
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse|View
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
@@ -121,8 +121,8 @@ class AttachmentController extends Controller
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
$message = 'Could not find the indicated attachment. The file is no longer there.';
|
||||||
throw new FireflyException('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
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function view(Attachment $attachment): LaravelResponse
|
public function view(Attachment $attachment): LaravelResponse|View
|
||||||
{
|
{
|
||||||
if ($this->repository->exists($attachment)) {
|
if ($this->repository->exists($attachment)) {
|
||||||
$content = $this->repository->getContent($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'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class ForgotPasswordController extends Controller
|
|||||||
$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));
|
$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));
|
||||||
Log::error($message);
|
Log::error($message);
|
||||||
|
|
||||||
return view('error', compact('message'));
|
return view('errors.error', compact('message'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate host header.
|
// validate host header.
|
||||||
@@ -138,7 +138,7 @@ class ForgotPasswordController extends Controller
|
|||||||
if ('web' !== config('firefly.authentication_guard')) {
|
if ('web' !== config('firefly.authentication_guard')) {
|
||||||
$message = sprintf('Cannot reset password when authenticating over "%s".', 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?
|
// is allowed to?
|
||||||
|
|||||||
@@ -158,12 +158,12 @@ class RegisterController extends Controller
|
|||||||
if (true === $allowRegistration) {
|
if (true === $allowRegistration) {
|
||||||
$message = 'You do not need an invite code on this installation.';
|
$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) {
|
if (false === $validCode) {
|
||||||
$message = 'Invalid code.';
|
$message = 'Invalid code.';
|
||||||
|
|
||||||
return view('error', compact('message'));
|
return view('errors.error', compact('message'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$email = $request->old('email');
|
$email = $request->old('email');
|
||||||
@@ -189,7 +189,7 @@ class RegisterController extends Controller
|
|||||||
if (false === $allowRegistration) {
|
if (false === $allowRegistration) {
|
||||||
$message = 'Registration is currently not available. If you are the administrator, you can enable this in the administration.';
|
$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');
|
$email = $request?->old('email');
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class ResetPasswordController extends Controller
|
|||||||
if ('web' !== config('firefly.authentication_guard')) {
|
if ('web' !== config('firefly.authentication_guard')) {
|
||||||
$message = sprintf('Cannot reset password when authenticating over "%s".', 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 = [
|
$rules = [
|
||||||
@@ -127,7 +127,7 @@ class ResetPasswordController extends Controller
|
|||||||
if ('web' !== config('firefly.authentication_guard')) {
|
if ('web' !== config('firefly.authentication_guard')) {
|
||||||
$message = sprintf('Cannot reset password when authenticating over "%s".', 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?
|
// is allowed to register?
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class ReportController extends Controller
|
|||||||
public function auditReport(Collection $accounts, Carbon $start, Carbon $end)
|
public function auditReport(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
if ($end < $start) {
|
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();
|
$this->repository->cleanupBudgets();
|
||||||
$start->endOfDay(); // end of day so the final balance is at the end of that day.
|
$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)
|
public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
if ($end < $start) {
|
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();
|
$this->repository->cleanupBudgets();
|
||||||
$start->endOfDay(); // end of day so the final balance is at the end of that day.
|
$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)
|
public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
if ($end < $start) {
|
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();
|
$this->repository->cleanupBudgets();
|
||||||
$start->endOfDay(); // end of day so the final balance is at the end of that day.
|
$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)
|
public function defaultReport(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
if ($end < $start) {
|
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();
|
$this->repository->cleanupBudgets();
|
||||||
@@ -336,7 +336,7 @@ class ReportController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($request->getEndDate() < $request->getStartDate()) {
|
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) {
|
$url = match ($reportType) {
|
||||||
@@ -361,7 +361,7 @@ class ReportController extends Controller
|
|||||||
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
if ($end < $start) {
|
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();
|
$this->repository->cleanupBudgets();
|
||||||
$start->endOfDay(); // end of day so the final balance is at the end of that day.
|
$start->endOfDay(); // end of day so the final balance is at the end of that day.
|
||||||
|
|||||||
42
resources/views/errors/error.blade.php
Normal file
42
resources/views/errors/error.blade.php
Normal file
@@ -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
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user