From 2c8e33558e0deab44399c3d371574b8475e3cc62 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 9 May 2025 09:55:32 +0200 Subject: [PATCH] Catch and log unexpected backup ciphering errors (#144531) --- homeassistant/components/backup/util.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/homeassistant/components/backup/util.py b/homeassistant/components/backup/util.py index 8112faf4459..1a32c938a54 100644 --- a/homeassistant/components/backup/util.py +++ b/homeassistant/components/backup/util.py @@ -332,6 +332,9 @@ def decrypt_backup( except (DecryptError, SecureTarError, tarfile.TarError) as err: LOGGER.warning("Error decrypting backup: %s", err) error = err + except Exception as err: # noqa: BLE001 + LOGGER.exception("Unexpected error when decrypting backup: %s", err) + error = err else: # Pad the output stream to the requested minimum size padding = max(minimum_size - output_stream.tell(), 0) @@ -417,6 +420,9 @@ def encrypt_backup( except (EncryptError, SecureTarError, tarfile.TarError) as err: LOGGER.warning("Error encrypting backup: %s", err) error = err + except Exception as err: # noqa: BLE001 + LOGGER.exception("Unexpected error when decrypting backup: %s", err) + error = err else: # Pad the output stream to the requested minimum size padding = max(minimum_size - output_stream.tell(), 0)