diff --git a/custom_components/spoolman/coordinator.py b/custom_components/spoolman/coordinator.py index 5dd31bf..0d0c9d7 100644 --- a/custom_components/spoolman/coordinator.py +++ b/custom_components/spoolman/coordinator.py @@ -55,7 +55,12 @@ async def _async_update_data(self): spools = await self.spoolman_api.get_spools( {"allow_archived": show_archived} ) + except Exception as exception: + raise UpdateFailed( + f"Error fetching data from API: {exception}" + ) from exception + try: klipper_url = config.get(KLIPPER_URL, "") if klipper_url is not None and klipper_url != "": klipper_active_spool: int | None = await KlipperAPI(klipper_url).get_active_spool_id() @@ -65,10 +70,8 @@ async def _async_update_data(self): spool["klipper_active_spool"] = True else: spool["klipper_active_spool"] = False - - return spools - except Exception as exception: - raise UpdateFailed( - f"Error fetching data from API: {exception}" - ) from exception + _LOGGER.error(f"Error processing Klipper API data: {exception}") + # Continue returning spools even if Klipper processing fails + + return spools