mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-01-24 23:12:21 +01:00
Added detailled debug infos
This commit is contained in:
parent
61af45e837
commit
8fb0cecfbe
@ -20,9 +20,15 @@ class ConfigurationResolver:
|
|||||||
if isinstance(current_config, dict):
|
if isinstance(current_config, dict):
|
||||||
for key, value in list(current_config.items()):
|
for key, value in list(current_config.items()):
|
||||||
if key == "link":
|
if key == "link":
|
||||||
target = self._find_entry(root_config, value.lower())
|
try:
|
||||||
current_config.clear()
|
target = self._find_entry(root_config, value.lower())
|
||||||
current_config.update(target)
|
current_config.clear()
|
||||||
|
current_config.update(target)
|
||||||
|
except Exception as e:
|
||||||
|
raise ValueError(
|
||||||
|
f"Error resolving link '{value}': {str(e)}. "
|
||||||
|
f"Current path: {key}, Current config: {current_config}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self._recursive_resolve(value, root_config)
|
self._recursive_resolve(value, root_config)
|
||||||
elif isinstance(current_config, list):
|
elif isinstance(current_config, list):
|
||||||
@ -44,16 +50,25 @@ class ConfigurationResolver:
|
|||||||
None
|
None
|
||||||
)
|
)
|
||||||
if found is None:
|
if found is None:
|
||||||
raise ValueError(f"No matching entry for '{part}' in list.")
|
raise ValueError(
|
||||||
|
f"No matching entry for '{part}' in list. Path so far: {' > '.join(parts[:parts.index(part)+1])}. "
|
||||||
|
f"Current list: {current}"
|
||||||
|
)
|
||||||
current = found
|
current = found
|
||||||
elif isinstance(current, dict):
|
elif isinstance(current, dict):
|
||||||
# Case-insensitive dictionary lookup
|
# Case-insensitive dictionary lookup
|
||||||
key = next((k for k in current if k.lower() == part), None)
|
key = next((k for k in current if k.lower() == part), None)
|
||||||
if key is None:
|
if key is None:
|
||||||
raise KeyError(f"Key '{part}' not found.")
|
raise KeyError(
|
||||||
|
f"Key '{part}' not found in dictionary. Path so far: {' > '.join(parts[:parts.index(part)+1])}. "
|
||||||
|
f"Current dictionary: {current}"
|
||||||
|
)
|
||||||
current = current[key]
|
current = current[key]
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Invalid path segment '{part}'. Current type is {type(current)}.")
|
raise ValueError(
|
||||||
|
f"Invalid path segment '{part}'. Current type: {type(current)}. "
|
||||||
|
f"Path so far: {' > '.join(parts[:parts.index(part)+1])}"
|
||||||
|
)
|
||||||
|
|
||||||
# Navigate into `subitems` if present
|
# Navigate into `subitems` if present
|
||||||
if isinstance(current, dict) and "subitems" in current:
|
if isinstance(current, dict) and "subitems" in current:
|
||||||
@ -65,4 +80,4 @@ class ConfigurationResolver:
|
|||||||
"""
|
"""
|
||||||
Returns the resolved configuration.
|
Returns the resolved configuration.
|
||||||
"""
|
"""
|
||||||
return self.config
|
return self.config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user