error-parser

1.0.0 • Public • Published

error-parser

Makes errors pretty & mostly readable

Usage

See tests for examples/use-cases.

npm install error-parser
var errorParser = require('error-parser');
 
// Some sample error
var error = new Error('Sample error');
 
var parsedError = errorParser(error);
 
console.log(parsedError);
/**
{
  message: 'Sample error',
  stack: {
    file: 'abc.js',
    line: 10,
    column: 2
  }
}
**/
 
 
/** Another Use-case - uncaughtException **/
 
process.on('uncaughtException', function(err) {
  console.log( errorParser(err) );
});
 
randomVar = randomVar + 1;
 
/**
{
  message: 'randomVar is not defined',
  stack: {
    file: 'test/uncaught_exception.js',
     line: '8',
     column: '13'
    }
  }
**/

Readme

Keywords

Package Sidebar

Install

npm i error-parser

Weekly Downloads

5

Version

1.0.0

License

GNU

Last publish

Collaborators

  • kevbook