From 31a4187cc0ac1438889e5550e656e58ec0a526b6 Mon Sep 17 00:00:00 2001 From: Robbie Trencheny Date: Fri, 8 Mar 2019 14:51:13 -0800 Subject: [PATCH] Log if aiohttp hits error during IndieAuth (#21780) * Log if aiohttp hits error during IndieAuth * Add content of redirect_url into error log Co-Authored-By: awarecan --- homeassistant/components/auth/indieauth.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/auth/indieauth.py b/homeassistant/components/auth/indieauth.py index 30432a612a4..1437685692b 100644 --- a/homeassistant/components/auth/indieauth.py +++ b/homeassistant/components/auth/indieauth.py @@ -1,4 +1,5 @@ """Helpers to resolve client ID/secret.""" +import logging import asyncio from ipaddress import ip_address from html.parser import HTMLParser @@ -9,6 +10,8 @@ from aiohttp.client_exceptions import ClientError from homeassistant.util.network import is_local +_LOGGER = logging.getLogger(__name__) + async def verify_redirect_uri(hass, client_id, redirect_uri): """Verify that the client and redirect uri match.""" @@ -78,7 +81,8 @@ async def fetch_redirect_uris(hass, url): if chunks == 10: break - except (asyncio.TimeoutError, ClientError): + except (asyncio.TimeoutError, ClientError) as ex: + _LOGGER.error("Error while looking up redirect_uri %s: %s", url, ex) pass # Authorization endpoints verifying that a redirect_uri is allowed for use