Correct logging and add test case for sharkiq (#41863)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
f499187835
commit
42cdbc7e1d
2 changed files with 6 additions and 2 deletions
|
@ -74,7 +74,7 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
|
|||
SharkIqNotAuthedError,
|
||||
SharkIqAuthExpiringError,
|
||||
) as err:
|
||||
_LOGGER.exception("Bad auth state")
|
||||
_LOGGER.debug("Bad auth state. Attempting re-auth", exc_info=err)
|
||||
flow_context = {
|
||||
"source": "reauth",
|
||||
"unique_id": self._config_entry.unique_id,
|
||||
|
@ -87,6 +87,7 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
|
|||
]
|
||||
|
||||
if not matching_flows:
|
||||
_LOGGER.debug("Re-initializing flows. Attempting re-auth")
|
||||
self.hass.async_create_task(
|
||||
self.hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
@ -94,6 +95,8 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
|
|||
data=self._config_entry.data,
|
||||
)
|
||||
)
|
||||
else:
|
||||
_LOGGER.debug("Matching flow found")
|
||||
|
||||
raise UpdateFailed(err) from err
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
|
|
|
@ -4,7 +4,7 @@ import enum
|
|||
from typing import Any, Iterable, List, Optional
|
||||
|
||||
import pytest
|
||||
from sharkiqpy import AylaApi, SharkIqAuthError, SharkIqVacuum
|
||||
from sharkiqpy import AylaApi, SharkIqAuthError, SharkIqNotAuthedError, SharkIqVacuum
|
||||
|
||||
from homeassistant.components.homeassistant import SERVICE_UPDATE_ENTITY
|
||||
from homeassistant.components.sharkiq import DOMAIN
|
||||
|
@ -217,6 +217,7 @@ async def test_locate(hass):
|
|||
[
|
||||
(None, True),
|
||||
(SharkIqAuthError, False),
|
||||
(SharkIqNotAuthedError, False),
|
||||
(RuntimeError, False),
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue