@Override
  public void convertAndThrowException(@NotNull final IOException e, @NotNull final HttpURLConnection con)
    throws IOException, CopyExceptionWithFailureReason {

    switch (con.getResponseCode()) {
      case SC_UNAUTHORIZED:
        throw new UnconfirmedUserException(getApplePhotosImportThrowingMessage("Unauthorized iCloud User"), e);
      case SC_PRECONDITION_FAILED:
        throw new PermissionDeniedException(getApplePhotosImportThrowingMessage("Permission Denied"), e);
      case SC_NOT_FOUND:
        throw new DestinationNotFoundException(getApplePhotosImportThrowingMessage("iCloud Photos Library not found"), e);
      case SC_INSUFFICIENT_STORAGE:
        throw new DestinationMemoryFullException(getApplePhotosImportThrowingMessage("iCloud Storage is full"), e);
      case SC_SERVICE_UNAVAILABLE:
        throw new IOException(getApplePhotosImportThrowingMessage("DTP import service unavailable"), e);
      case SC_BAD_REQUEST:
        throw new IOException(getApplePhotosImportThrowingMessage("Bad request sent to iCloud Photos import api"), e);
      case SC_INTERNAL_SERVER_ERROR:
        throw new IOException(getApplePhotosImportThrowingMessage("Internal server error in iCloud Photos service"), e);
      case SC_OK:
        break;
      default:
        throw e;
    }
  }
An interface that is synonymous to HTTP client to interact with the Apple Photos APIs.
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/photos/AppleMediaInterface.java