From 4ccc686295022721e24c45d34bd19ee7c0eab6a0 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Wed, 15 Jan 2025 13:59:42 +0100 Subject: [PATCH] Improve logging of backup upload errors (#135672) Improve logging for upload errors --- homeassistant/components/backup/manager.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/backup/manager.py b/homeassistant/components/backup/manager.py index 83121e8bf38..76e1c261e31 100644 --- a/homeassistant/components/backup/manager.py +++ b/homeassistant/components/backup/manager.py @@ -430,18 +430,21 @@ class BackupManager: return_exceptions=True, ) for idx, result in enumerate(sync_backup_results): + agent_id = agent_ids[idx] if isinstance(result, BackupReaderWriterError): # writer errors will affect all agents # no point in continuing raise BackupManagerError(str(result)) from result if isinstance(result, BackupAgentError): - LOGGER.error("Error uploading to %s: %s", agent_ids[idx], result) - agent_errors[agent_ids[idx]] = result + agent_errors[agent_id] = result + LOGGER.error("Upload failed for %s: %s", agent_id, result) continue if isinstance(result, Exception): # trap bugs from agents - agent_errors[agent_ids[idx]] = result - LOGGER.error("Unexpected error: %s", result, exc_info=result) + agent_errors[agent_id] = result + LOGGER.error( + "Unexpected error for %s: %s", agent_id, result, exc_info=result + ) continue if isinstance(result, BaseException): raise result