diff --git a/custom_components/google_contacts/coordinator.py b/custom_components/google_contacts/coordinator.py index 937ab1f..c0120e9 100644 --- a/custom_components/google_contacts/coordinator.py +++ b/custom_components/google_contacts/coordinator.py @@ -1,5 +1,6 @@ """Coordinator for fetching data from Google Contacts API.""" +from aiodns.error import DNSError import asyncio from collections.abc import AsyncGenerator, Sequence from contextlib import asynccontextmanager @@ -363,6 +364,13 @@ async def _async_request_synchronize_contacts( await self._async_request_get_contacts(store) return + except DNSError as dnsError: + _LOGGER.error( + "DNS error synchronizing contacts: %s. Not performing update", + dnsError, + ) + return + for contact in contacts.contacts.values(): if contact.deleted: _LOGGER.info("Removing contact: %s", contact.resource_name) @@ -401,6 +409,13 @@ async def _async_request_synchronize_groups( await self._async_request_get_groups(store) return + except DNSError as dnsError: + _LOGGER.error( + "DNS error synchronizing groups: %s. Not performing update", + dnsError, + ) + return + for group in groups.groups.values(): if group.deleted: _LOGGER.info("Removing group: %s", group.resource_name)