mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 14:15:12 +02:00
add timeout error
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Support for NWS weather service."""
|
||||
import asyncio
|
||||
from collections import OrderedDict
|
||||
from datetime import timedelta
|
||||
from json import JSONDecodeError
|
||||
@@ -149,7 +150,8 @@ async def async_setup_platform(hass, config, async_add_entities,
|
||||
try:
|
||||
with async_timeout.timeout(10, loop=hass.loop):
|
||||
stations = await nws.stations()
|
||||
except aiohttp.ClientError, JSONDecodeError as status:
|
||||
except (aiohttp.ClientError, JSONDecodeError,
|
||||
asyncio.CancelledError) as status:
|
||||
_LOGGER.error("Error getting station list for %s: %s",
|
||||
nws.latlon, status)
|
||||
raise PlatformNotReady
|
||||
|
Reference in New Issue
Block a user