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);
@ -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) {