mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 18:25:26 -04:00
fix(settings): catch PermissionError in load_settings + error-path tests (#1570)
PermissionError was not in the except tuple so an unreadable settings.json would crash the app instead of falling back to defaults. Added alongside the existing FileNotFoundError/JSONDecodeError/ValueError catches. Also adds test_settings_error_paths.py covering all four failure modes: missing file, corrupted JSON, wrong type, and permission denied.
This commit is contained in:
+1
-1
@@ -187,7 +187,7 @@ def load_settings() -> dict:
|
||||
if not isinstance(saved, dict):
|
||||
raise ValueError("settings must be an object")
|
||||
merged = {**DEFAULT_SETTINGS, **saved}
|
||||
except (FileNotFoundError, json.JSONDecodeError, ValueError):
|
||||
except (FileNotFoundError, PermissionError, json.JSONDecodeError, ValueError):
|
||||
merged = dict(DEFAULT_SETTINGS)
|
||||
_settings_cache = (now, merged)
|
||||
return merged
|
||||
|
||||
Reference in New Issue
Block a user