error-parser
v1.0.0
Published
Makes errors pretty & mostly readable
Downloads
3
Readme
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'
}
}
**/