🐛 Add errno to Restify's errors!
Based on restify-errors-options
DEPRECATED!!!
$ npm install --save restify-errors-options-errno
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'}
- Simone Primarosa - simonepri
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details.