Skip to content

Commit bd21b68

Browse files
committed
Add error handling for category info
1 parent 746362f commit bd21b68

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ml_peg/app/build_app.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,14 @@ def build_category(
103103

104104
for category in all_layouts:
105105
# Get category name and description
106-
with open(APP_ROOT / category / f"{category}.yml") as file:
107-
category_info = safe_load(file)
108-
category_title = category_info["title"]
109-
category_descrip = category_info["description"]
106+
try:
107+
with open(APP_ROOT / category / f"{category}.yml") as file:
108+
category_info = safe_load(file)
109+
category_title = category_info.get("title", category)
110+
category_descrip = category_info.get("description", "")
111+
except FileNotFoundError:
112+
category_title = category
113+
category_descrip = ""
110114

111115
# Build summary table
112116
summary_table = build_summary_table(

0 commit comments

Comments
 (0)