v1.12.0 — Narrow exception handling, refactor library internals
Summary
Medium-severity review follow-ups. Pure refactor + error-handling-hygiene release — no UI-visible behaviour change, but unexpected failures now surface as real errors instead of being silently swallowed.
Integration
Exception handling narrowed
Replaced broad except Exception catch-alls in critical paths with precise type tuples:
base_coordinator(WS connect, stale WS disconnect, token revoke on shutdown) →(aiohttp.ClientError, TimeoutError, OSError)mqtt_bridge(state + availability publish) →HomeAssistantErrorcoordinator._async_handle_mqtt_command→HomeAssistantError+GardenaExceptionconfig_flow→ mapped domain types via lookup tables,_LOGGER.exceptionfor everything else
ConfigFlow error mapping extracted
Three separate if/elif ladders mapping GardenaAuthenticationError / GardenaForbiddenError / GardenaRateLimitError / GardenaConnectionError to translation keys are now a single dict[type[Exception], str] (_GARDENA_ERROR_MAP at module level; local map for Automower because its exception types are lazy-imported). Adding a new mapped exception is now a one-line change.
aiogardenasmart 0.1.8 → 0.1.9
Three matching micro-refactors in the pinned dependency:
- Header cache —
GardenaClientcaches the static parts of the request header (Authorization-Provider,X-Api-Key,Accept,Content-Type) once in__init__; onlyAuthorizationis rebuilt per request. setdefault—_parse_devicescollapses sixif not in: devices[x] = ...patterns into a singledict.setdefault.- Dispatch table —
GardenaWebSocket._apply_service_updatereplaces a five-branchif/elifcascade with_SINGLETON_SERVICES: dict[ServiceType, tuple[attr_name, service_cls]]. Adding a new singleton service is a one-line change.
Also cleared two pre-existing mypy warnings (models._attr_timestamp now returns properly typed str | None; stale # type: ignore[unreachable] in auth.py removed).
Test status
- 591 integration tests pass
- 104 library tests pass
ruff check,ruff format --check,mypy --strictall clean
🤖 Generated with Claude Code