mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Catch "throwable"
This commit is contained in:
parent
6f0ac91bd2
commit
42f39536a1
@ -37,6 +37,8 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
|||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -90,7 +92,6 @@ class ReconcileController extends Controller
|
|||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function overview(Request $request, Account $account, Carbon $start, Carbon $end): JsonResponse
|
public function overview(Request $request, Account $account, Carbon $start, Carbon $end): JsonResponse
|
||||||
{
|
{
|
||||||
@ -123,15 +124,24 @@ class ReconcileController extends Controller
|
|||||||
}
|
}
|
||||||
$difference = bcadd(bcadd(bcsub($startBalance, $endBalance), $clearedAmount), $amount);
|
$difference = bcadd(bcadd(bcsub($startBalance, $endBalance), $clearedAmount), $amount);
|
||||||
$diffCompare = bccomp($difference, '0');
|
$diffCompare = bccomp($difference, '0');
|
||||||
$return = [
|
|
||||||
'post_uri' => $route,
|
try {
|
||||||
'html' => view(
|
$view = view(
|
||||||
'accounts.reconcile.overview', compact(
|
'accounts.reconcile.overview', compact(
|
||||||
'account', 'start', 'diffCompare', 'difference', 'end', 'clearedIds', 'transactionIds', 'clearedAmount',
|
'account', 'start', 'diffCompare', 'difference', 'end', 'clearedIds', 'transactionIds', 'clearedAmount',
|
||||||
'startBalance', 'endBalance', 'amount',
|
'startBalance', 'endBalance', 'amount',
|
||||||
'route', 'countCleared'
|
'route', 'countCleared'
|
||||||
)
|
)
|
||||||
)->render(),
|
)->render();
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Log::debug(sprintf('View error: %s', $e->getMessage()));
|
||||||
|
$view = 'Could not render accounts.reconcile.overview';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$return = [
|
||||||
|
'post_uri' => $route,
|
||||||
|
'html' => $view,
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->json($return);
|
return response()->json($return);
|
||||||
@ -148,7 +158,6 @@ class ReconcileController extends Controller
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function transactions(Account $account, Carbon $start, Carbon $end)
|
public function transactions(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -180,9 +189,14 @@ class ReconcileController extends Controller
|
|||||||
$collector->setAccounts(new Collection([$account]))
|
$collector->setAccounts(new Collection([$account]))
|
||||||
->setRange($selectionStart, $selectionEnd)->withBudgetInformation()->withOpposingAccount()->withCategoryInformation();
|
->setRange($selectionStart, $selectionEnd)->withBudgetInformation()->withOpposingAccount()->withCategoryInformation();
|
||||||
$transactions = $collector->getJournals();
|
$transactions = $collector->getJournals();
|
||||||
$html = view(
|
try {
|
||||||
'accounts.reconcile.transactions', compact('account', 'transactions', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
$html = view(
|
||||||
)->render();
|
'accounts.reconcile.transactions', compact('account', 'transactions', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
||||||
|
)->render();
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
|
||||||
|
$html = 'Could not render accounts.reconcile.transactions';
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
|
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ use FireflyIII\Http\Controllers\Controller;
|
|||||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AccountController.
|
* Class AccountController.
|
||||||
@ -43,7 +45,6 @@ class AccountController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -60,8 +61,12 @@ class AccountController extends Controller
|
|||||||
/** @var AccountTaskerInterface $accountTasker */
|
/** @var AccountTaskerInterface $accountTasker */
|
||||||
$accountTasker = app(AccountTaskerInterface::class);
|
$accountTasker = app(AccountTaskerInterface::class);
|
||||||
$accountReport = $accountTasker->getAccountReport($accounts, $start, $end);
|
$accountReport = $accountTasker->getAccountReport($accounts, $start, $end);
|
||||||
|
try {
|
||||||
$result = view('reports.partials.accounts', compact('accountReport'))->render();
|
$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);
|
$cache->store($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -27,6 +27,8 @@ use FireflyIII\Helpers\Report\BalanceReportHelperInterface;
|
|||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BalanceController.
|
* Class BalanceController.
|
||||||
@ -42,7 +44,6 @@ class BalanceController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -58,8 +59,12 @@ class BalanceController extends Controller
|
|||||||
}
|
}
|
||||||
$helper = app(BalanceReportHelperInterface::class);
|
$helper = app(BalanceReportHelperInterface::class);
|
||||||
$balance = $helper->getBalanceReport($accounts, $start, $end);
|
$balance = $helper->getBalanceReport($accounts, $start, $end);
|
||||||
|
try {
|
||||||
$result = view('reports.partials.balance', compact('balance'))->render();
|
$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);
|
$cache->store($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -28,6 +28,8 @@ use FireflyIII\Http\Controllers\Controller;
|
|||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BudgetController.
|
* Class BudgetController.
|
||||||
@ -43,7 +45,6 @@ class BudgetController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -58,8 +59,12 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
$helper = app(BudgetReportHelperInterface::class);
|
$helper = app(BudgetReportHelperInterface::class);
|
||||||
$budgets = $helper->getBudgetReport($start, $end, $accounts);
|
$budgets = $helper->getBudgetReport($start, $end, $accounts);
|
||||||
|
try {
|
||||||
$result = view('reports.partials.budgets', compact('budgets'))->render();
|
$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);
|
$cache->store($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -74,7 +79,6 @@ class BudgetController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function period(Collection $accounts, Carbon $start, Carbon $end)
|
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"
|
$data[0] = $repository->getNoBudgetPeriodReport($accounts, $start, $end); // append report data for "no budget"
|
||||||
$report = $this->filterBudgetPeriodReport($data);
|
$report = $this->filterBudgetPeriodReport($data);
|
||||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||||
|
try {
|
||||||
$result = view('reports.partials.budget-period', compact('report', 'periods'))->render();
|
$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);
|
$cache->store($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -27,6 +27,8 @@ use FireflyIII\Http\Controllers\Controller;
|
|||||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class OperationsController.
|
* Class OperationsController.
|
||||||
@ -63,7 +65,6 @@ class OperationsController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -78,7 +79,12 @@ class OperationsController extends Controller
|
|||||||
}
|
}
|
||||||
$entries = $this->tasker->getExpenseReport($start, $end, $accounts);
|
$entries = $this->tasker->getExpenseReport($start, $end, $accounts);
|
||||||
$type = 'expense-entry';
|
$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);
|
$cache->store($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -92,7 +98,6 @@ class OperationsController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function income(Collection $accounts, Carbon $start, Carbon $end): string
|
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);
|
$entries = $this->tasker->getIncomeReport($start, $end, $accounts);
|
||||||
$type = 'income-entry';
|
$type = 'income-entry';
|
||||||
|
try {
|
||||||
$result = view('reports.partials.income-expenses', compact('entries', 'type'))->render();
|
$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);
|
$cache->store($result);
|
||||||
|
|
||||||
@ -122,7 +132,6 @@ class OperationsController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -155,8 +164,12 @@ class OperationsController extends Controller
|
|||||||
$expenses
|
$expenses
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
try {
|
||||||
$result = view('reports.partials.operations', compact('incomeSum', 'expensesSum'))->render();
|
$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);
|
$cache->store($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
Loading…
Reference in New Issue
Block a user