Skip to content

Commit

Permalink
#165 Handle TimeoutError as a recoverable error
Browse files Browse the repository at this point in the history
  • Loading branch information
wlcrs committed Oct 28, 2022
1 parent 1f24927 commit c6d53dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import logging
import asyncio
from collections.abc import Awaitable, Callable
from datetime import timedelta
from typing import TypedDict, TypeVar
Expand Down Expand Up @@ -144,11 +145,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
DATA_UPDATE_COORDINATORS: update_coordinators,
DATA_OPTIMIZER_UPDATE_COORDINATORS: optimizer_update_coordinators,
}
except HuaweiSolarException as err:
except (HuaweiSolarException, TimeoutError, asyncio.TimeoutError) as err:
if primary_bridge is not None:
await primary_bridge.stop()

raise ConfigEntryNotReady from err

except Exception as err:
# always try to stop the bridge, as it will keep retrying
# in the background otherwise!
Expand Down

0 comments on commit c6d53dd

Please sign in to comment.