How to use extract-stack - 2 common examples

To help you get started, we’ve selected a few extract-stack 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 jamiebuilds / naw / src / cli.ts View on Github external
.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(() => {
github foundation / panini / lib / engine.js View on Github external
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
    });
  }
}

extract-stack

Extract the actual stack of an error

MIT
Latest version published 3 years ago

Package Health Score

68 / 100
Full package analysis

Popular extract-stack functions