Fix error handling

This commit is contained in:
Raymond Feng 2015-07-29 10:21:47 -07:00
parent b7042b982f
commit 4d7bfc94cd
1 changed files with 6 additions and 5 deletions

View File

@ -1382,7 +1382,7 @@ DataAccessObject.find = function find(query, options, cb) {
var allCb = function(err, data) {
var results = [];
if (Array.isArray(data)) {
if (!err && Array.isArray(data)) {
async.each(data, function(item, callback) {
var d = item;//data[i];
var Model = self.lookupModel(d);
@ -1434,7 +1434,7 @@ DataAccessObject.find = function find(query, options, cb) {
callback();
});
}
},
},
function(err) {
if (err) return cb(err);
@ -1448,8 +1448,9 @@ DataAccessObject.find = function find(query, options, cb) {
cb(err, results);
});
}
else
cb(err, []);
else {
cb(err, data || []);
}
};
if (options.notify === false) {
@ -2370,7 +2371,7 @@ DataAccessObject.prototype.updateAttributes = function updateAttributes(data, op
return;
} else if (strict === 'validate') {
inst.__unknownProperties.push(key);
}
}
}
data = removeUndefined(result);
}