Don't miserably fail if we can't load detail for a log entry

This commit is contained in:
Alexandre Aubin 2019-08-05 18:24:12 +02:00
parent 376cce4f53
commit d507d447dd

View file

@ -103,7 +103,12 @@ def log_list(category=[], limit=None, with_details=False):
entry["started_at"] = log_datetime
if with_details:
metadata = read_yaml(md_path)
try:
metadata = read_yaml(md_path)
except Exception as e:
# If we can't read the yaml for some reason, report an error and ignore this entry...
logger.error(m18n.n('log_corrupted_md_file', md_file=md_path, error=e))
continue
entry["success"] = metadata.get("success", "?") if metadata else "?"
result[category].append(entry)