1
0
Fork 0
mirror of synced 2024-06-28 11:00:35 +12:00

ignore json parsing errors when loading link jsons

This commit is contained in:
Nick Sweeting 2019-04-24 11:38:13 -04:00
parent e91cdfbc88
commit 03470699d3

View file

@ -96,8 +96,11 @@ def parse_json_link_details(out_dir: str) -> Optional[Link]:
existing_index = os.path.join(out_dir, JSON_INDEX_FILENAME)
if os.path.exists(existing_index):
with open(existing_index, 'r', encoding='utf-8') as f:
link_json = json.load(f)
return Link.from_json(link_json)
try:
link_json = json.load(f)
return Link.from_json(link_json)
except json.JSONDecodeError:
pass
return None
@enforce_types