0.1.2 • Published 6 years ago
restify-errors-options-errno v0.1.2
restify-errors-options-errno
🐛 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
- Simone Primarosa - simonepri
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.