From 09af3f38ee8e559b96f19da741059afc48c92ed6 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 18 Sep 2025 16:29:26 +0200 Subject: [PATCH] clan_lib: allow delete on non-existing data --- pkgs/clan-cli/clan_lib/persist/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/persist/util.py b/pkgs/clan-cli/clan_lib/persist/util.py index 9ac15a79b..49e2baa4d 100644 --- a/pkgs/clan-cli/clan_lib/persist/util.py +++ b/pkgs/clan-cli/clan_lib/persist/util.py @@ -431,9 +431,11 @@ def delete_by_path(d: dict[str, Any], path: str) -> Any: last_key = keys[-1] try: value = current.pop(last_key) - except KeyError as exc: - msg = f"Cannot delete. Path '{path}' not found in data '{d}'" - raise KeyError(msg) from exc + except KeyError: + # Possibly data was already deleted + # msg = f"Canot delete. Path '{path}' not found in data '{d}'" + # raise KeyError(msg) from exc + return {} else: return {last_key: value}