npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

error-plus

0.0.1 • Public • Published

_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

install

npm i error-plus

Downloadsweekly downloads

0

version

0.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability