forked from ComputerTech/bastebin
Show JSON decoding errors in production.py
This commit is contained in:
parent
af4ac1287c
commit
2977bfffb1
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Reference in New Issue