Skip to content

Commit 1848c57

Browse files
committed
remove try and catch
1 parent 7ecc60d commit 1848c57

File tree

1 file changed

+19
-27
lines changed

1 file changed

+19
-27
lines changed

src/build/mdn-comments.ts

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -132,32 +132,24 @@ export async function generateDescriptions(): Promise<{
132132
}
133133

134134
const results: Record<string, any> = {};
135-
try {
136-
const indexPaths = await walkDirectory(basePath);
137-
138-
await Promise.all(
139-
indexPaths.map(async (fileURL) => {
140-
try {
141-
const content = await fs.readFile(fileURL, "utf-8");
142-
const slug = generateSlug(content);
143-
const types = generateTypes(content);
144-
if (!slug || slug.length === 0 || (types && types[0] === "ignore"))
145-
return;
146-
147-
const summary = extractSummary(content);
148-
if (
149-
summary ===
150-
"When writing code for the Web, there are a large number of Web APIs available."
151-
)
152-
console.log(types, slug, summary);
153-
insertComment(results, slug, summary, types);
154-
} catch (error) {
155-
console.error("Error generating API descriptions:", error);
156-
}
157-
}),
158-
);
159-
} catch (err) {
160-
console.error("Error generating API descriptions:", err);
161-
}
135+
const indexPaths = await walkDirectory(basePath);
136+
137+
await Promise.all(
138+
indexPaths.map(async (fileURL) => {
139+
const content = await fs.readFile(fileURL, "utf-8");
140+
const slug = generateSlug(content);
141+
const types = generateTypes(content);
142+
if (!slug || slug.length === 0 || (types && types[0] === "ignore"))
143+
return;
144+
145+
const summary = extractSummary(content);
146+
if (
147+
summary ===
148+
"When writing code for the Web, there are a large number of Web APIs available."
149+
)
150+
console.log(types, slug, summary);
151+
insertComment(results, slug, summary, types);
152+
}),
153+
);
162154
return { interfaces: { interface: results } };
163155
}

0 commit comments

Comments
 (0)