class HostDeletionService {

    public void deleteHostsWithDeleteException(FreeIpaClient client, Set<String> hosts) throws FreeIpaClientException, DeleteException {
        try {
            Pair<Set<String>, Map<String, String>> removeHostsResult = removeHosts(client, hosts);
            if (!removeHostsResult.getSecond().isEmpty()) {
                throw new DeleteException(HOST_DELETION_FAILED + ' ' + removeHostsResult.getSecond());
            }
        } catch (RetryableFreeIpaClientException e) {
            LOGGER.error(HOST_DELETION_FAILED + ' ' + e.getLocalizedMessage(), e);
            throw new RetryableFreeIpaClientException(HOST_DELETION_FAILED, e, new DeleteException(HOST_DELETION_FAILED));
        } catch (FreeIpaClientException e) {
            LOGGER.error(HOST_DELETION_FAILED + ' ' + e.getLocalizedMessage(), e);
            throw new DeleteException(HOST_DELETION_FAILED);
        }
    }

}