1.0.8 • Published 7 years ago

neat-errors v1.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Neat Errors for NodeJs

This is a really neat error reporter for NodeJS, featuring code extraction, stack cleaning, syntax highlighting and tweakable output out-of-the-box.

Usage

Easiest way is to require neat-errors/register at the top of your application entry point:

import "neat-errors/register";

// do your stuff here ...

If not possible in your case, then you can use the full programmatic API:

import Neat from "neat-errors"

const neat = new Neat()

process.on('uncaughtException', e => {
  console.error(neat.render(e));
  process.exit(1);
})

Unless specified manually, neat-errors will check for the following options in process.argv and adapt its behaviour accodingly:

  • --full-stack-trace: do not clean the stack trace before rendering
  • --print-all-code print a code excerpt for all call sites in the stack trace

Other than that, the following arguments can be supplied to Neat as an options object:

  • cwd: current working directory to make paths relative to.
  • printAllCode: defaults to checking process.argv for its value
  • fullStackTrace: defaults to checking process.argv for its value

Contributing

Suggestions? Found a bug? You are more than welcome to contribute! Please browse the current issues to check if someone else got to it first before submitting a new one.

Related projects

License

The MIT License

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago