mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 14:12:15 +00:00
Throw errors instead of abort()
This commit is contained in:
@@ -7,6 +7,7 @@ use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use DB;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
use FireflyIII\Models\AccountType;
|
||||
@@ -482,7 +483,9 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$existingAccount = Account::firstOrNullEncrypted($searchData);
|
||||
if (!$existingAccount) {
|
||||
Log::error('Account create error: ' . $newAccount->getErrors()->toJson());
|
||||
abort(500);
|
||||
throw new FireflyException(
|
||||
'Cannot create a new account. See also the log files. First error is: ' . e($newAccount->getErrors()->first()) . '.'
|
||||
);
|
||||
}
|
||||
$newAccount = $existingAccount;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace FireflyIII\Repositories\Journal;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Budget;
|
||||
@@ -349,14 +350,14 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
|
||||
if (is_null($toAccount)) {
|
||||
Log::error('"to"-account is null, so we cannot continue!');
|
||||
abort(500, '"to"-account is null, so we cannot continue!');
|
||||
throw new FireflyException('"to"-account is null, so we cannot continue!');
|
||||
// @codeCoverageIgnoreStart
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
if (is_null($fromAccount)) {
|
||||
Log::error('"from"-account is null, so we cannot continue!');
|
||||
abort(500, '"from"-account is null, so we cannot continue!');
|
||||
throw new FireflyException('"from"-account is null, so we cannot continue!');
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user