Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.catch(err => {
finalError = err
if (err instanceof ProcessError && err.code === 1) {
return
}
let [type] = err.stack.match(ERROR_TYPE_REGEX)
let message = replaceAll(err.message, /"(.*?)"/g, chalk.cyan('"$1"'))
let stack = chalk.italic(extractStack(err))
println("")
println("{bold.red %s}{bold %s}\n{dim %s}", type, message, stack)
println("")
})
.then(() => {
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
});
}
}