Show better error message when using addDevice on a linked device

This commit is contained in:
AsamK 2023-08-21 17:14:04 +02:00
parent 3d13c69e41
commit 6d23eb3bf6
4 changed files with 13 additions and 7 deletions

View file

@ -117,7 +117,7 @@ public interface Manager extends Closeable {
void removeLinkedDevices(int deviceId) throws IOException;
void addDeviceLink(DeviceLinkUrl linkUri) throws IOException, InvalidDeviceLinkException;
void addDeviceLink(DeviceLinkUrl linkUri) throws IOException, InvalidDeviceLinkException, NotPrimaryDeviceException;
void setRegistrationLockPin(Optional<String> pin) throws IOException, NotPrimaryDeviceException;

View file

@ -362,7 +362,10 @@ public class ManagerImpl implements Manager {
}
@Override
public void addDeviceLink(DeviceLinkUrl linkUrl) throws IOException, InvalidDeviceLinkException {
public void addDeviceLink(DeviceLinkUrl linkUrl) throws IOException, InvalidDeviceLinkException, NotPrimaryDeviceException {
if (!account.isPrimaryDevice()) {
throw new NotPrimaryDeviceException();
}
context.getAccountHelper().addDevice(linkUrl);
}