mirror of
https://github.com/home-assistant/core.git
synced 2025-05-08 07:59:18 +00:00
Make google tasks recoverable (#134092)
This commit is contained in:
parent
5e0088feaa
commit
7076ba7c9d
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user