Show JSON decoding errors in production.py

This commit is contained in:
ComputerTech 2026-03-31 12:23:10 +01:00
parent af4ac1287c
commit 2977bfffb1
1 changed files with 4 additions and 2 deletions

View File

@ -265,8 +265,10 @@ def main() -> None:
try:
with open(config_path, 'r') as f:
config = json.load(f)
except (json.JSONDecodeError, IOError):
pass
except json.JSONDecodeError as e:
sys.exit(f"Error: Failed to parse '{config_path}': {e}\nPlease check for syntax errors (like trailing commas).")
except IOError as e:
print(f"Warning: Could not read '{config_path}': {e}")
server_cfg = config.get('server', {})
default_host = server_cfg.get('host', '0.0.0.0')