From 528e1733eea211d78a2a7bbf6bf6e510882c1c6c Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Fri, 15 Mar 2024 21:58:01 +0100 Subject: [PATCH] fix: warning for deletion failure --- scripts/add_item.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/add_item.py b/scripts/add_item.py index 2637abd..36966b0 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…") with open(f"./data/{media_type}/{log}.json", "w", encoding="utf-8") as log_file: json.dump(log_items, log_file, indent=4)