Catch "throwable"

This commit is contained in:
James Cole
2018-08-07 19:29:40 +02:00
parent 6f0ac91bd2
commit 42f39536a1
5 changed files with 71 additions and 26 deletions

View File

@@ -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;