fix: alert for failed deletions
This commit is contained in:
parent
0d6c9907e5
commit
e2ac8e18f0
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue