mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-11-29 08:55:48 +00:00
Print more detailed error message when registering with non-normalized number
Fixes #958
This commit is contained in:
1 parent
cf07512d24
commit
995eaa6e7c
7 files changed
+35
-4
No files matched your search
@@ -12,6 +12,7 @@ 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;
|
||||
@@ -76,6 +77,8 @@ public class RegisterCommand implements RegistrationCommand, JsonRpcRegistration
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.asamk.signal.manager.ProvisioningManager;
|
||||
import org.asamk.signal.manager.RegistrationManager;
|
||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||
import org.asamk.signal.manager.api.IncorrectPinException;
|
||||
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||
import org.asamk.signal.manager.api.PinLockedException;
|
||||
import org.asamk.signal.manager.api.UserAlreadyExistsException;
|
||||
import org.freedesktop.dbus.DBusPath;
|
||||
@@ -61,6 +62,8 @@ public class DbusSignalControlImpl implements org.asamk.SignalControl {
|
||||
} catch (CaptchaRequiredException e) {
|
||||
String message = captcha == null ? "Captcha required for verification." : "Invalid captcha given.";
|
||||
throw new SignalControl.Error.RequiresCaptcha(message);
|
||||
} catch (NonNormalizedPhoneNumberException e) {
|
||||
throw new Error.InvalidNumber(e.getMessage());
|
||||
} catch (OverlappingFileLockException e) {
|
||||
throw new SignalControl.Error.Failure("Account is already in use");
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in new issue
Block a user