mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-10-30 17:17:03 +08:00
Just warn when a file doesn't exist
This commit is contained in:
@ -63,7 +63,13 @@ readDirPromise('./')
|
|||||||
|
|
||||||
|
|
||||||
async function processMDFile(filePath = '/', templateHTML = null) {
|
async function processMDFile(filePath = '/', templateHTML = null) {
|
||||||
const mdSrc = await readFilePromise(filePath);
|
let mdSrc;
|
||||||
|
try {
|
||||||
|
mdSrc = await readFilePromise(filePath);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`Failed to read file [${filePath}], does it exist?`);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
const generatedHTML = converter.makeHtml(mdSrc);
|
const generatedHTML = converter.makeHtml(mdSrc);
|
||||||
let nexHTML = generatedHTML;
|
let nexHTML = generatedHTML;
|
||||||
if (templateHTML) {
|
if (templateHTML) {
|
||||||
|
|||||||
Reference in New Issue
Block a user