src/validator.js
function(path, fieldValue, errors, errorsContent)
    {
        var e = {};
        var er = {};
        if (_.isArray(errors) && errors.length > 0) {
            er.errors = errors;
        }
        if (_.isArray(errorsContent) && errorsContent.length > 0) {
            er.content = errorsContent;
        }

        var self           = new Error();
        self.__proto__     = FieldValidatorError.prototype;
        self.message       = er;
        self.name          = 'FieldValidatorError';
        self.path          = path;
        self.fieldValue    = fieldValue;
        self.errors        = errors || [];
        self.errorsContent = errorsContent || [];

        return self;
    }
function(path, fieldValue, errors, errorsContent)
    {
        var e = {};
        var er = {};
        if (_.isArray(errors) && errors.length > 0) {
            er.errors = errors;
        }
        if (_.isArray(errorsContent) && errorsContent.length > 0) {
            er.content = errorsContent;
        }

        var self           = new Error();
        self.__proto__     = FieldValidatorError.prototype;
        self.message       = er;
        self.name          = 'FieldValidatorError';
        self.path          = path;
        self.fieldValue    = fieldValue;
        self.errors        = errors || [];
        self.errorsContent = errorsContent || [];

        return self;
    }
function ( path , fieldValue , errors , errorsContent ) { var e = { } ; var er = { } ; if ( _ . isArray ( errors ) && errors . length > 0 ) { er . errors = errors ; } if ( _ . isArray ( errorsContent ) && errorsContent . length > 0 ) { er . content = errorsContent ; } var self = new Error ( ) ; self . __proto__ = FieldValidatorError . prototype ; self . message = er ; self . name = 'FieldValidatorError' ; self . path = path ; self . fieldValue = fieldValue ; self . errors = errors || [ ] ; self . errorsContent = errorsContent || [ ] ; return self ; }
Error class to handle validation errors on a field
@param string path          The field's path
@param mixed  fieldValue    The field value
@param array  errors        An array of ValidationError
@param array  errorsContent An array of ValidationError on the field children
Error class to handle validation errors on a field