Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 2.11 KB

File metadata and controls

42 lines (30 loc) · 2.11 KB

restify-errors-options-errno

Greenkeeper badge Travis CI Codecov npm npm version npm dependencies npm dev dependencies

🐛 Add errno to Restify's errors!

Based on restify-errors-options

Install

$ npm install --save restify-errors-options-errno

Usage

const restifyErrorOtionsErrno = require('restify-errors-options-errno');
// Is extremely important to require restify-errors-options-errno before restify.
const restify = require('restify');

restifyErrorOtionsErrno.install();
var server = restify.createServer();

server.on('MethodNotAllowed', (req, res, err, cb) => {
  console.log(err.body.errno);
  //=> 'MNAE'
  cb();
});

const err = new restify.errors.MethodNotAllowedError({errno: '42'}});
console.log(err.toJSON());
//=> {code: 'MethodNotAllowed', message: '', errno: '42'}

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.