mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Handle UnauthenticatedResponseException internally
This commit is contained in:
parent
782f96b580
commit
31dec5a666
7 changed files with 16 additions and 24 deletions
|
@ -6,9 +6,7 @@ import net.sourceforge.argparse4j.inf.Subparser;
|
|||
import org.asamk.signal.OutputWriter;
|
||||
import org.asamk.signal.commands.exceptions.CommandException;
|
||||
import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
@ -31,8 +29,6 @@ public class RemovePinCommand implements JsonRpcLocalCommand {
|
|||
) throws CommandException {
|
||||
try {
|
||||
m.setRegistrationLockPin(Optional.empty());
|
||||
} catch (UnauthenticatedResponseException e) {
|
||||
throw new UnexpectedErrorException("Remove pin failed with unauthenticated response: " + e.getMessage(), e);
|
||||
} catch (IOException e) {
|
||||
throw new IOErrorException("Remove pin error: " + e.getMessage(), e);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,7 @@ import net.sourceforge.argparse4j.inf.Subparser;
|
|||
import org.asamk.signal.OutputWriter;
|
||||
import org.asamk.signal.commands.exceptions.CommandException;
|
||||
import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
@ -34,9 +32,6 @@ public class SetPinCommand implements JsonRpcLocalCommand {
|
|||
try {
|
||||
var registrationLockPin = ns.getString("pin");
|
||||
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
||||
} catch (UnauthenticatedResponseException e) {
|
||||
throw new UnexpectedErrorException("Set pin error failed with unauthenticated response: " + e.getMessage(),
|
||||
e);
|
||||
} catch (IOException e) {
|
||||
throw new IOErrorException("Set pin error: " + e.getMessage(), e);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemo
|
|||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -167,7 +166,7 @@ public class DbusManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRegistrationLockPin(final Optional<String> pin) throws IOException, UnauthenticatedResponseException {
|
||||
public void setRegistrationLockPin(final Optional<String> pin) throws IOException {
|
||||
if (pin.isPresent()) {
|
||||
signal.setPin(pin.get());
|
||||
} else {
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
|||
import org.freedesktop.dbus.types.Variant;
|
||||
import org.whispersystems.signalservice.api.messages.SendMessageResult;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -583,8 +582,6 @@ public class DbusSignalImpl implements Signal {
|
|||
public void removePin() {
|
||||
try {
|
||||
m.setRegistrationLockPin(Optional.empty());
|
||||
} catch (UnauthenticatedResponseException e) {
|
||||
throw new Error.Failure("Remove pin failed with unauthenticated response: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure("Remove pin error: " + e.getMessage());
|
||||
}
|
||||
|
@ -594,8 +591,6 @@ public class DbusSignalImpl implements Signal {
|
|||
public void setPin(String registrationLockPin) {
|
||||
try {
|
||||
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
||||
} catch (UnauthenticatedResponseException e) {
|
||||
throw new Error.Failure("Set pin error failed with unauthenticated response: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure("Set pin error: " + e.getMessage());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue