Level 7 yay!

This commit is contained in:
James Cole
2025-01-04 19:43:58 +01:00
parent 1aa8ebe57f
commit 0f69e0d672
27 changed files with 76 additions and 76 deletions

View File

@@ -88,21 +88,21 @@ class StoreController extends Controller
try {
$transactionGroup = $this->groupRepository->store($data);
} catch (DuplicateTransactionException $e) { // @phpstan-ignore-line
} catch (DuplicateTransactionException $e) {
app('log')->warning('Caught a duplicate transaction. Return error message.');
$validator = \Validator::make(
['transactions' => [['description' => $e->getMessage()]]],
['transactions.0.description' => new IsDuplicateTransaction()]
);
throw new ValidationException($validator); // @phpstan-ignore-line
} catch (FireflyException $e) { // @phpstan-ignore-line
throw new ValidationException($validator);
} catch (FireflyException $e) {
app('log')->warning('Caught an exception. Return error message.');
app('log')->error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = \Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator); // @phpstan-ignore-line
throw new ValidationException($validator);
}
app('preferences')->mark();
$applyRules = $data['apply_rules'] ?? true;

View File

@@ -239,7 +239,7 @@ class ListController extends Controller
$unfiltered = $recurringRepos->getAll();
// filter selection
$collection = $unfiltered->filter( // @phpstan-ignore-line
$collection = $unfiltered->filter(
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) {
@@ -286,7 +286,7 @@ class ListController extends Controller
$ruleRepos = app(RuleRepositoryInterface::class);
$unfiltered = $ruleRepos->getAll();
$collection = $unfiltered->filter( // @phpstan-ignore-line
$collection = $unfiltered->filter(
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
/** @var RuleTrigger $trigger */
foreach ($rule->ruleTriggers as $trigger) {

View File

@@ -80,21 +80,21 @@ class StoreController extends Controller
try {
$transactionGroup = $this->groupRepository->store($data);
} catch (DuplicateTransactionException $e) { // @phpstan-ignore-line
} catch (DuplicateTransactionException $e) {
app('log')->warning('Caught a duplicate transaction. Return error message.');
$validator = Validator::make(
['transactions' => [['description' => $e->getMessage()]]],
['transactions.0.description' => new IsDuplicateTransaction()]
);
throw new ValidationException($validator); // @phpstan-ignore-line
} catch (FireflyException $e) { // @phpstan-ignore-line
throw new ValidationException($validator);
} catch (FireflyException $e) {
app('log')->warning('Caught an exception. Return error message.');
app('log')->error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator); // @phpstan-ignore-line
throw new ValidationException($validator);
}
app('preferences')->mark();
$applyRules = $data['apply_rules'] ?? true;