Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log error when doc generation fail #250

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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