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 <awarecan@users.noreply.github.com>
pull/21835/head
Robbie Trencheny 2019-03-08 14:51:13 -08:00 committed by Paulus Schoutsen
parent 3d8673dbf8
commit 31a4187cc0
1 changed files with 5 additions and 1 deletions

View File

@ -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