diff --git a/libbot/sync/__init__.py b/libbot/sync/__init__.py index 2553dce..180ba98 100644 --- a/libbot/sync/__init__.py +++ b/libbot/sync/__init__.py @@ -55,7 +55,9 @@ def nested_set(target: dict, value: Any, *path: str, create_missing=True) -> dic elif create_missing: d = d.setdefault(key, {}) else: - return target + raise KeyError( + f"Key '{key}' is not found under path provided ({path}) and create_missing is False" + ) if path[-1] in d or create_missing: d[path[-1]] = value return target