if (username == null) {
var usernames = Manager.getAllLocalUsernames(dataPath);
- if (usernames.size() == 0) {
- throw new UserErrorException("No local users found, you first need to register or link an account");
- }
if (command instanceof MultiLocalCommand) {
handleMultiLocalCommand((MultiLocalCommand) command, dataPath, serviceEnvironment, usernames);
return;
}
- if (usernames.size() > 1) {
+ if (usernames.size() == 0) {
+ throw new UserErrorException("No local users found, you first need to register or link an account");
+ } else if (usernames.size() > 1) {
throw new UserErrorException(
"Multiple users found, you need to specify a username (phone number) with -u");
}
) throws CommandException {
final var managers = new ArrayList<Manager>();
for (String u : usernames) {
- managers.add(loadManager(u, dataPath, serviceEnvironment));
+ try {
+ managers.add(loadManager(u, dataPath, serviceEnvironment));
+ } catch (CommandException e) {
+ logger.warn("Ignoring {}: {}", u, e.getMessage());
+ }
}
command.handleCommand(ns, managers);