return 1;
}
- $user = $this->userManager->createUser(
- $input->getArgument('uid'),
- $password
- );
+ try {
+ $user = $this->userManager->createUser(
+ $input->getArgument('uid'),
+ $password
+ );
+ } catch (\Exception $e) {
+ $output->writeln('<error>' . $e->getMessage() . '</error>');
+ return 1;
+ }
+
if ($user instanceof IUser) {
$output->writeln('<info>The user "' . $user->getUID() . '" was created successfully</info>');
return 1;
}
- $success = $user->setPassword($password);
+
+ try {
+ $success = $user->setPassword($password);
+ } catch (\Exception $e) {
+ $output->writeln('<error>' . $e->getMessage() . '</error>');
+ return 1;
+ }
+
if ($success) {
$output->writeln("<info>Successfully reset password for " . $username . "</info>");
} else {