Skip to content

Commit 6a36867

Browse files
committed
Handle JSON loading errors
1 parent f4a48fa commit 6a36867

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/plamo_translate/servers/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ def update_config(**kwargs) -> Dict[str, Any]:
142142
)
143143
else:
144144
with tmp_config_path.open("r") as f:
145-
config = json.load(f)
145+
try:
146+
config = json.load(f)
147+
except json.JSONDecodeError:
148+
logger.warning(f"Config file {tmp_config_path} is corrupted. Recreating it.")
149+
config = {}
146150
for key, value in kwargs.items():
147151
config[key] = value
148152

0 commit comments

Comments
 (0)