mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-10-30 00:57:04 +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) {
|
||||
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);
|
||||
let nexHTML = generatedHTML;
|
||||
if (templateHTML) {
|
||||
|
||||
Reference in New Issue
Block a user