API that provides formatting and highlight options for errors and their stack trace
An API that provides various options for formatting and highlighting Errors. May be useful for logging and test frameworks for example.
Stack lines can be filtered in and out based on patterns and limited by range (e.g. lines 2 through 10). Stack lines and error message can have highlights applied based on patterns. Finally stack lines can be formatted to include or exclude available fields.
The API is quite flexible with a range of methods varying in level with means to specify custom highlights and formats.
$ npm install formaterrors
Or include as a dependency within packakage.json and use: npm link.
var formatErrors = require("formaterrors");
Then invoke the provided APIs on instances of Error or Error.stack as required.
Some examples are available within the examples folder. They can be executed as follows:
Here is the HTML source of the API docs. These docs needs to be downloaded and opened in a browser.
First install the dependencies:
$ npm link
Then to run the tests:
$ npm test