Skip to content

Commit

Permalink
Added missing catch
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Jul 30, 2022
1 parent 0fd0be3 commit 76e40e8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/Commands/ServiceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@ protected function configure(): void
*/
protected function execute(Input\InputInterface $input, Output\OutputInterface $output): int
{
$symfonyApp = $this->getApplication();

if ($symfonyApp === null) {
return Console\Command\Command::FAILURE;
}

$io = new Style\SymfonyStyle($input, $output);

$io->title('FB devices module - service');
Expand All @@ -175,7 +169,21 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $
}

if ($input->getOption('connector')) {
$this->executeConnector($io, $input);
try {
$this->executeConnector($io, $input);

} catch (Exceptions\TerminateException $ex) {
$this->logger->debug('Stopping connector', [
'source' => Metadata\Constants::MODULE_DEVICES_SOURCE,
'type' => 'service-cmd',
'exception' => [
'message' => $ex->getMessage(),
'code' => $ex->getCode(),
],
]);

$this->eventLoop->stop();
}
}

return Console\Command\Command::SUCCESS;
Expand Down

0 comments on commit 76e40e8

Please sign in to comment.