Skip to content

Commit

Permalink
log error when doc generation fail (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
kandros authored Apr 5, 2024
1 parent d1ffa01 commit 617ede6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions app/lib/gh-docs/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,20 @@ async function fetchDoc(key: string): Promise<Doc> {
if (md === null) {
throw Error(`Could not find ${filename} in ${repo}@${ref}`);
}
let { html, attributes } = await processMarkdown(md);
let attrs: MenuDocAttributes = { title: filename };
if (isPlainObject(attributes)) {
attrs = { title: filename, ...attributes };
}
try {
let { html, attributes } = await processMarkdown(md);
let attrs: MenuDocAttributes = { title: filename };
if (isPlainObject(attributes)) {
attrs = { title: filename, ...attributes };
}

// sorry, cheerio is so much easier than using rehype stuff.
let headings = createTableOfContentsFromHeadings(html);
return { attrs, filename, html, slug, headings, children: [] };
// sorry, cheerio is so much easier than using rehype stuff.
let headings = createTableOfContentsFromHeadings(html);
return { attrs, filename, html, slug, headings, children: [] };
} catch (err) {
console.error(`Error processing doc file ${filename} in ${ref}`, err);
throw err;
}
}

// create table of contents from h2 and h3 headings
Expand Down

0 comments on commit 617ede6

Please sign in to comment.