Update error handling in update coordinator (#32452)
This commit is contained in:
parent
f62322cfb4
commit
b27c46750c
8 changed files with 58 additions and 67 deletions
|
@ -1,9 +1,7 @@
|
|||
"""Support for the Philips Hue sensors as a platform."""
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from aiohttp import client_exceptions
|
||||
from aiohue import AiohueException, Unauthorized
|
||||
from aiohue.sensors import TYPE_ZLL_PRESENCE
|
||||
import async_timeout
|
||||
|
@ -60,9 +58,9 @@ class SensorManager:
|
|||
)
|
||||
except Unauthorized:
|
||||
await self.bridge.handle_unauthorized_error()
|
||||
raise UpdateFailed
|
||||
except (asyncio.TimeoutError, AiohueException, client_exceptions.ClientError):
|
||||
raise UpdateFailed
|
||||
raise UpdateFailed("Unauthorized")
|
||||
except AiohueException as err:
|
||||
raise UpdateFailed(f"Hue error: {err}")
|
||||
|
||||
async def async_register_component(self, binary, async_add_entities):
|
||||
"""Register async_add_entities methods for components."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue