- e.printStackTrace();
- return 3;
- } catch (InvalidKeyException | URISyntaxException e) {
- e.printStackTrace();
- return 2;
- } catch (AssertionError e) {
- handleAssertionError(e);
- return 1;
+ logger.error("Add device link failed: {}", e.getMessage());
+ throw new IOErrorException("Add device link failed", e);
+ } catch (InvalidDeviceLinkException e) {
+ logger.info("Invalid device link");
+ throw new UserErrorException("Invalid device link", e);
+ } catch (DeviceLimitExceededException e) {
+ throw new UserErrorException("Account has too many linked devices already", e);
+ } catch (NotPrimaryDeviceException e) {
+ throw new UserErrorException("This command doesn't work on linked devices.");