fix: warning for deletion failure

This commit is contained in:
Ben Goldsworthy 2024-03-15 21:58:01 +01:00
parent 0d6c9907e5
commit 528e1733ee
Signed by: Rumperuu
SSH key fingerprint: SHA256:e5XfzNOr9UvWpEzyLfw0GtTMZWIFh3NmxH+/qQIi3xE

View file

@ -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)