Skip to content

Commit 8ea5a43

Browse files
authored
fix: graceful failure if project config is missing (#97)
1 parent 08eb585 commit 8ea5a43

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

server/index.mjs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ app.use("/api/projects", async (req, res) => {
6868
// File missing or invalid JSON — keep config as null
6969
}
7070

71-
projects.push({
72-
folder: entry.name,
73-
config: {
74-
name: String(config.name), // TODO: ensure this is not null
75-
hidden: Boolean(config.hidden) ?? false,
76-
default: Boolean(config.default) ?? false,
77-
examples: config.examples ?? [], // TODO: validate
78-
},
79-
});
71+
if (config) {
72+
projects.push({
73+
folder: entry.name,
74+
config: {
75+
name: String(config.name), // TODO: ensure this is not null
76+
hidden: Boolean(config.hidden) ?? false,
77+
default: Boolean(config.default) ?? false,
78+
examples: config.examples ?? [], // TODO: validate
79+
},
80+
});
81+
}
8082
}
8183

8284
res.json(projects);

0 commit comments

Comments
 (0)