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");
}
try {
manager = RegistrationManager.init(username, dataPath, serviceEnvironment, BaseConfig.USER_AGENT);
} catch (Throwable e) {
- throw new UnexpectedErrorException("Error loading or creating state file: " + e.getMessage());
+ throw new UnexpectedErrorException("Error loading or creating state file: "
+ + e.getMessage()
+ + " ("
+ + e.getClass().getSimpleName()
+ + ")");
}
try (var m = manager) {
command.handleCommand(ns, m);
) 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);
} catch (NotRegisteredException e) {
throw new UserErrorException("User " + username + " is not registered.");
} catch (Throwable e) {
- throw new UnexpectedErrorException("Error loading state file for user " + username + ": " + e.getMessage());
+ throw new UnexpectedErrorException("Error loading state file for user "
+ + username
+ + ": "
+ + e.getMessage()
+ + " ("
+ + e.getClass().getSimpleName()
+ + ")");
}
try {
var legacySettingsPath = new File(configPath, "signal");
if (legacySettingsPath.exists()) {
+ logger.warn("Using legacy data path \"{}\", please move it to \"{}\".", legacySettingsPath, dataPath);
return legacySettingsPath;
}
legacySettingsPath = new File(configPath, "textsecure");
if (legacySettingsPath.exists()) {
+ logger.warn("Using legacy data path \"{}\", please move it to \"{}\".", legacySettingsPath, dataPath);
return legacySettingsPath;
}