Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function writeErr(message: string | Error, level: LogLevel): void {
let error = prettyError(message, {color: false});
// prefix with parcel: to clarify the source of errors
writeErrLine('parcel: ' + error.message);
if (error.stack != null && logLevels[level] >= logLevels.verbose) {
writeErrLine(error.stack);
}
}
async send500(req: Request, res: Response) {
setHeaders(res);
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.writeHead(500);
if (this.error) {
let error = prettyError(this.error, {color: true});
error.message = ansiHtml(error.message);
error.stack = ansiHtml(error.stack);
res.end(
ejs.render(TEMPLATE_500, {
error
})
);
} else {
res.end();
}
}