不要怂,就是干,撸起袖子干!

introduce the Sequelize signed Error Objects, starting with ValidatorError

1 parent e807a7c2
Showing with 29 additions and 1 deletions
var Validator = require("validator")
, Utils = require("./utils")
, sequelizeError = require("./errors")
var DaoValidator = module.exports = function(model, options) {
options = options || {}
......@@ -27,7 +28,7 @@ DaoValidator.prototype.validate = function() {
emitter.emit('success')
})
.error(function(err) {
var error = new Error('Validation error')
var error = new sequelizeError.ValidationError('Validation error')
error[DaoValidator.RAW_KEY_NAME] = []
Utils._.each(err, function (value) {
......
/**
* @fileOverview The Error Objects produced by Sequelize.
*/
var util = require('util')
var error = module.exports = {}
/**
* The Base Error all Sequelize Errors inherit from.
*
* @constructor
*/
error.BaseError = function() {
Error.call(this)
};
util.inherits(error.BaseError, Error)
/**
* Validation Error
*
* @constructor
*/
error.ValidationError = function() {
error.BaseError.call(this)
};
util.inherits(error.ValidationError, error.BaseError)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!