How to use the @parcel/utils.prettyError function in @parcel/utils

To help you get started, we’ve selected a few @parcel/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github parcel-bundler / parcel / packages / reporters / cli / src / SimpleCLIReporter.js View on Github external
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);
  }
}
github parcel-bundler / parcel / packages / reporters / dev-server / src / Server.js View on Github external
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();
    }
  }