mirror of
https://github.com/home-assistant/core.git
synced 2025-08-07 04:28:19 +00:00
Make sure to clean up httpx session on failed connection to Axis device (#42428)
This commit is contained in:
parent
93e71ef218
commit
e3d29429d3
@ -280,12 +280,15 @@ async def get_device(hass, host, port, username, password):
|
||||
|
||||
except axis.Unauthorized as err:
|
||||
LOGGER.warning("Connected to device at %s but not registered.", host)
|
||||
await device.vapix.close()
|
||||
raise AuthenticationRequired from err
|
||||
|
||||
except (asyncio.TimeoutError, axis.RequestError) as err:
|
||||
LOGGER.error("Error connecting to the Axis device at %s", host)
|
||||
await device.vapix.close()
|
||||
raise CannotConnect from err
|
||||
|
||||
except axis.AxisException as err:
|
||||
LOGGER.exception("Unknown Axis communication error occurred")
|
||||
await device.vapix.close()
|
||||
raise AuthenticationRequired from err
|
||||
|
Loading…
x
Reference in New Issue
Block a user