Skip to content

Commit

Permalink
remove the catch blocks from the commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick in t Veld committed Aug 22, 2024
1 parent 29475a8 commit 2c48f2b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
10 changes: 3 additions & 7 deletions src/Command/AccountCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$aggregator = new AggregateRoot();

try {
($this->accountActionHandler)($aggregator);
$this->accountTable->setRows($aggregator->getAccounts())->render($output);
} catch (\Throwable $e) {
$io->error($e->getMessage());
return Command::FAILURE;
}
($this->accountActionHandler)($aggregator);

$this->accountTable->setRows($aggregator->getAccounts())->render($output);

return Command::SUCCESS;
}
Expand Down
9 changes: 2 additions & 7 deletions src/Command/DailyDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$aggregator = new DailyDataAggregator();

try {
($this->dailyDataActionHandler)($aggregator);
$this->dailyDataTable->setRows($aggregator->getData())->render($output);
} catch (\Throwable $e) {
$io->error($e->getMessage());
return Command::FAILURE;
}
($this->dailyDataActionHandler)($aggregator);

$this->dailyDataTable->setRows($aggregator->getData())->render($output);

return Command::SUCCESS;
}
Expand Down
10 changes: 3 additions & 7 deletions src/Command/DailyGainCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$aggregator = new DailyGainsAggregator();

try {
($this->dailyGainActionHandler)($aggregator);
$this->dailyGainTable->setRows($aggregator->getData())->render($output);
} catch (\Throwable $e) {
$io->error($e->getMessage());
return Command::FAILURE;
}
($this->dailyGainActionHandler)($aggregator);

$this->dailyGainTable->setRows($aggregator->getData())->render($output);

return Command::SUCCESS;
}
Expand Down
10 changes: 3 additions & 7 deletions src/Command/HistoryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$aggregator = new HistoryAggregator();

try {
($this->historyActionHandler)($aggregator);
$this->historyTable->setRows($aggregator->getData())->render($output);
} catch (\Exception $e) {
$io->error($e->getMessage());
return Command::FAILURE;
}
($this->historyActionHandler)($aggregator);

$this->historyTable->setRows($aggregator->getData())->render($output);

return Command::SUCCESS;
}
Expand Down

0 comments on commit 2c48f2b

Please sign in to comment.