}
try {
writer.println("{}", m.getDeviceLinkUri());
- try (var manager = m.finishDeviceLink(deviceName)) {
- writer.println("Associated with: {}", manager.getUsername());
- }
+ var number = m.finishDeviceLink(deviceName);
+ writer.println("Associated with: {}", number);
} catch (TimeoutException e) {
throw new UserErrorException("Link request timed out, please try again.");
} catch (IOException e) {
- throw new IOErrorException("Link request error: " + e.getMessage());
+ throw new IOErrorException("Link request error: " + e.getMessage(), e);
} catch (UserAlreadyExists e) {
throw new UserErrorException("The user "
- + e.getUsername()
+ + e.getNumber()
+ " already exists\nDelete \""
+ e.getFileName()
+ "\" before trying again.");