Make google tasks recoverable (#134092)

This commit is contained in:
Joost Lekkerkerker
2024-12-27 17:52:33 +01:00
committed by GitHub
parent 5e0088feaa
commit 7076ba7c9d

View File

@@ -9,6 +9,7 @@ from google.oauth2.credentials import Credentials
from googleapiclient.discovery import Resource, build from googleapiclient.discovery import Resource, build
from googleapiclient.errors import HttpError from googleapiclient.errors import HttpError
from googleapiclient.http import BatchHttpRequest, HttpRequest from googleapiclient.http import BatchHttpRequest, HttpRequest
from httplib2 import ServerNotFoundError
from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@@ -150,7 +151,7 @@ class AsyncConfigEntryAuth:
async def _execute(self, request: HttpRequest | BatchHttpRequest) -> Any: async def _execute(self, request: HttpRequest | BatchHttpRequest) -> Any:
try: try:
result = await self._hass.async_add_executor_job(request.execute) result = await self._hass.async_add_executor_job(request.execute)
except HttpError as err: except (HttpError, ServerNotFoundError) as err:
raise GoogleTasksApiError( raise GoogleTasksApiError(
f"Google Tasks API responded with: {err.reason or err.status_code})" f"Google Tasks API responded with: {err.reason or err.status_code})"
) from err ) from err