From 770554b6cba69647ccb2831eed4966bc52017a90 Mon Sep 17 00:00:00 2001 From: Josh Willox Date: Mon, 6 Jan 2025 17:06:00 +1100 Subject: [PATCH] fix: improve error message and handling when unable to purge a backup --- custom_components/auto_backup/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/custom_components/auto_backup/__init__.py b/custom_components/auto_backup/__init__.py index fd307b9..dc6c9b9 100644 --- a/custom_components/auto_backup/__init__.py +++ b/custom_components/auto_backup/__init__.py @@ -467,14 +467,16 @@ async def _purge_snapshot(self, slug): _LOGGER.debug("Attempting to remove backup: %s", slug) try: await self._handler.remove_backup(slug) - # remove snapshot expiry. - del self._snapshots[slug] except HassioAPIError as err: + message = "Failed to purge backup: %s, If it was intentionally moved or deleted externally you can ignore this error." if str(err) == "Backup does not exist": - del self._snapshots[slug] + _LOGGER.warning(message, err) else: - _LOGGER.error("Failed to purge backup: %s", err) - return False + _LOGGER.error(message, err) + return False + finally: + # remove snapshot expiry. + del self._snapshots[slug] return True def async_download_backup(self, name, slug, backup_path):