import net.sourceforge.argparse4j.inf.Namespace;
import net.sourceforge.argparse4j.inf.Subparser;
-import org.asamk.signal.JsonWriter;
import org.asamk.signal.OutputType;
import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.commands.exceptions.IOErrorException;
import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.RegistrationManager;
import org.asamk.signal.manager.api.CaptchaRequiredException;
+import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
+import org.asamk.signal.output.JsonWriter;
import java.io.IOException;
import java.util.List;
String message;
if (captcha == null) {
message = """
- Captcha required for verification, use --captcha CAPTCHA
- To get the token, go to https://signalcaptchas.org/registration/generate.html
- Check the developer tools (F12) console for a failed redirect to signalcaptcha://
- Everything after signalcaptcha:// is the captcha token.""";
+ Captcha required for verification, use --captcha CAPTCHA
+ To get the token, go to https://signalcaptchas.org/registration/generate.html
+ Check the developer tools (F12) console for a failed redirect to signalcaptcha://
+ Everything after signalcaptcha:// is the captcha token.""";
} else {
message = "Invalid captcha given.";
}
throw new UserErrorException(message);
+ } catch (NonNormalizedPhoneNumberException e) {
+ throw new UserErrorException("Failed to register: " + e.getMessage(), e);
} catch (IOException e) {
- throw new IOErrorException("Request verify error: " + e.getMessage(), e);
+ throw new IOErrorException("Failed to register: " + e.getMessage(), e);
}
}