X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/221d937eecca5c9b09a3bee7df812203b9927a56..0455d3e8a85bfde8832efd2da44def3c818e2c9d:/src/main/java/org/asamk/signal/App.java diff --git a/src/main/java/org/asamk/signal/App.java b/src/main/java/org/asamk/signal/App.java index 5b2c91c6..af3fea4c 100644 --- a/src/main/java/org/asamk/signal/App.java +++ b/src/main/java/org/asamk/signal/App.java @@ -133,16 +133,15 @@ public class App { 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"); } @@ -181,7 +180,11 @@ public class App { 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); @@ -211,7 +214,11 @@ public class App { ) throws CommandException { final var managers = new ArrayList(); 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); @@ -234,7 +241,13 @@ public class App { } 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 { @@ -296,11 +309,13 @@ public class App { 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; }