From 473cb5901344b2aa287e3bac75454c9aa946784d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Bregu=C5=82a?= Date: Mon, 29 Dec 2025 22:12:40 +0100 Subject: [PATCH] Add translation of exceptions in met (#155765) Co-authored-by: mik-laj <12058428+mik-laj@users.noreply.github.com> Co-authored-by: Joostlek --- homeassistant/components/met/coordinator.py | 8 ++++++-- homeassistant/components/met/strings.json | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/met/coordinator.py b/homeassistant/components/met/coordinator.py index b2c43cb1361..0ba3b9e1626 100644 --- a/homeassistant/components/met/coordinator.py +++ b/homeassistant/components/met/coordinator.py @@ -116,8 +116,12 @@ class MetDataUpdateCoordinator(DataUpdateCoordinator[MetWeatherData]): """Fetch data from Met.""" try: return await self.weather.fetch_data() - except Exception as err: - raise UpdateFailed(f"Update failed: {err}") from err + except CannotConnect as err: + raise UpdateFailed( + translation_domain=DOMAIN, + translation_key="update_failed", + translation_placeholders={"error": str(err)}, + ) from err def track_home(self) -> None: """Start tracking changes to HA home setting.""" diff --git a/homeassistant/components/met/strings.json b/homeassistant/components/met/strings.json index 6ac527775a0..7bd13b37531 100644 --- a/homeassistant/components/met/strings.json +++ b/homeassistant/components/met/strings.json @@ -19,6 +19,11 @@ } } }, + "exceptions": { + "update_failed": { + "message": "Update of data from the web site failed: {error}" + } + }, "options": { "step": { "init": {