Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error(error, filePath) {
const fileName = path.relative(process.cwd(), filePath);
if (!errorTemplate) {
const errorPage = fs.readFileSync(path.join(__dirname, 'error-template.hbs'));
errorTemplate = Handlebars.compile(errorPage.toString());
}
return errorTemplate({
message: error.message,
stack: extractStack.lines(error).join('\n'),
fileName
});
}
}