Mongoose error handler normalizer
npm install mongoose-errorsbash
npm i --save mongoose-errors
`Usage
Simple example
`bash
const MongooseErrors = require('mongoose-errors')
const ModelSchema = new Schema({
requiredField: {
type: String,
required: true
}
});ModelSchema.plugin(MongooseErrors);
Model = mongoose.model('ModelName', ModelSchema);
Model
.create(test)
.catch(error => {
console.log(error.statusCode);
// print 400 which is http bad request error code
done();
});
`Testing
* Clone this repository* Install all development dependencies
`sh
$ npm install
`
* Then run test
`sh
$ npm test
``We use SemVer for versioning. For the versions available, see the tags on this repository.
Isaac Kasongoyo - Initial work*
This project is licensed under the MIT License - see the LICENSE.md file for details