mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 08:30:06 +00:00
Catch "throwable"
This commit is contained in:
@@ -27,6 +27,8 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class AccountController.
|
||||
@@ -43,7 +45,6 @@ class AccountController extends Controller
|
||||
*
|
||||
* @return mixed|string
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -60,8 +61,12 @@ class AccountController extends Controller
|
||||
/** @var AccountTaskerInterface $accountTasker */
|
||||
$accountTasker = app(AccountTaskerInterface::class);
|
||||
$accountReport = $accountTasker->getAccountReport($accounts, $start, $end);
|
||||
|
||||
$result = view('reports.partials.accounts', compact('accountReport'))->render();
|
||||
try {
|
||||
$result = view('reports.partials.accounts', compact('accountReport'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.accounts: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -27,6 +27,8 @@ use FireflyIII\Helpers\Report\BalanceReportHelperInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class BalanceController.
|
||||
@@ -42,7 +44,6 @@ class BalanceController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -58,8 +59,12 @@ class BalanceController extends Controller
|
||||
}
|
||||
$helper = app(BalanceReportHelperInterface::class);
|
||||
$balance = $helper->getBalanceReport($accounts, $start, $end);
|
||||
|
||||
$result = view('reports.partials.balance', compact('balance'))->render();
|
||||
try {
|
||||
$result = view('reports.partials.balance', compact('balance'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -28,6 +28,8 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class BudgetController.
|
||||
@@ -43,7 +45,6 @@ class BudgetController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -58,8 +59,12 @@ class BudgetController extends Controller
|
||||
}
|
||||
$helper = app(BudgetReportHelperInterface::class);
|
||||
$budgets = $helper->getBudgetReport($start, $end, $accounts);
|
||||
|
||||
$result = view('reports.partials.budgets', compact('budgets'))->render();
|
||||
try {
|
||||
$result = view('reports.partials.budgets', compact('budgets'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budgets: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
@@ -74,7 +79,6 @@ class BudgetController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function period(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -95,8 +99,12 @@ class BudgetController extends Controller
|
||||
$data[0] = $repository->getNoBudgetPeriodReport($accounts, $start, $end); // append report data for "no budget"
|
||||
$report = $this->filterBudgetPeriodReport($data);
|
||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||
|
||||
$result = view('reports.partials.budget-period', compact('report', 'periods'))->render();
|
||||
try {
|
||||
$result = view('reports.partials.budget-period', compact('report', 'periods'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -27,6 +27,8 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class OperationsController.
|
||||
@@ -63,7 +65,6 @@ class OperationsController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -78,7 +79,12 @@ class OperationsController extends Controller
|
||||
}
|
||||
$entries = $this->tasker->getExpenseReport($start, $end, $accounts);
|
||||
$type = 'expense-entry';
|
||||
$result = view('reports.partials.income-expenses', compact('entries', 'type'))->render();
|
||||
try {
|
||||
$result = view('reports.partials.income-expenses', compact('entries', 'type'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.income-expense: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
@@ -92,7 +98,6 @@ class OperationsController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function income(Collection $accounts, Carbon $start, Carbon $end): string
|
||||
{
|
||||
@@ -107,7 +112,12 @@ class OperationsController extends Controller
|
||||
}
|
||||
$entries = $this->tasker->getIncomeReport($start, $end, $accounts);
|
||||
$type = 'income-entry';
|
||||
try {
|
||||
$result = view('reports.partials.income-expenses', compact('entries', 'type'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.income-expenses: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
@@ -122,7 +132,6 @@ class OperationsController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -155,8 +164,12 @@ class OperationsController extends Controller
|
||||
$expenses
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
$result = view('reports.partials.operations', compact('incomeSum', 'expensesSum'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.operations: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user