0.0.1 • Published 11 years ago

error-plus v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
11 years ago

_error

A simple extension to the Node.js built-in Error object to allow you to pass an object to the constructor whose keys will be put into the Error object.

Usage

Perhaps you currently do this:

var err = new Error('Something bad happened');
err.statusCode = 400;
err.pertinentInformation = 'something';
return callback(err);

Now you can now do this:

var _Error = require('error-plus');
return callback(new _Error('Something bad happened', {statusCode: 400, pertinentInformation: 'something'}));

That's all there is to it.

Tests are included.

Licence

MIT