Skip to content

Commit 6d25029

Browse files
Merge pull request #6 from kraken-chris/main
Resolve issue with return type and add error handling
2 parents d511046 + e62371b commit 6d25029

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Console/DisableInactiveAccounts.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ protected function configure(): void
3838
* @param OutputInterface $output
3939
* @return void
4040
*/
41-
protected function execute(InputInterface $input, OutputInterface $output): void
41+
protected function execute(InputInterface $input, OutputInterface $output): int
4242
{
43-
$output->writeln(__("Disabling any admin accounts with 90 days of inactivity"));
44-
$this->disableInactiveAdminAccounts->execute();
45-
$output->writeln(__("Disabling of accounts complete"));
43+
try {
44+
$output->writeln(__("Disabling any admin accounts with 90 days of inactivity"));
45+
$this->disableInactiveAdminAccounts->execute();
46+
$output->writeln(__("Disabling of accounts complete"));
47+
return Command::SUCCESS;
48+
} catch (\Throwable $t) {
49+
$output->writeln(__("<error>Error: {$e->getMessage()}</error>"));
50+
return Command::FAILURE;
51+
}
4652
}
4753
}

0 commit comments

Comments
 (0)