Handle invalid JSON settings file
This commit is contained in:
1 parent
fac2788e4b
commit
071b0f4cd6
1 file changed
+4
@@ -69,7 +69,11 @@ if not os.path.isfile(SETTINGS_PATH):
|
||||
)
|
||||
terminate()
|
||||
with open(SETTINGS_PATH, 'r', encoding="utf8") as file:
|
||||
try:
|
||||
settings: Dict[str, Any] = json.load(file)
|
||||
except json.JSONDecodeError as exc:
|
||||
print(f"Error while reading the settings file:\n{str(exc)}")
|
||||
terminate()
|
||||
required_fields = ["channels"]
|
||||
for field_name in required_fields:
|
||||
if field_name not in settings:
|
||||
|
||||
Reference in new issue
Block a user