From e2ac8e18f06ae6add6ce97f65cd152dcc0070485 Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Fri, 15 Mar 2024 21:36:47 +0100 Subject: [PATCH] fix: alert for failed deletions --- scripts/add_item.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/add_item.py b/scripts/add_item.py index 2637abd..88e29ed 100644 --- a/scripts/add_item.py +++ b/scripts/add_item.py @@ -118,6 +118,8 @@ def delete_existing(item_id: str, media_type: str, log: str) -> None: ] if len(log_items) < (old_len - 1): raise Exception("More than one deletion made, discarding…") + elif len(log_items) == old_len: + raise Exception("No item deleted, skipping…"s) with open(f"./data/{media_type}/{log}.json", "w", encoding="utf-8") as log_file: json.dump(log_items, log_file, indent=4)