Add error logging for missing data

This commit is contained in:
Ritchie Martori 2014-05-12 10:36:10 -07:00
parent 908221416e
commit 4bab42478f
1 changed files with 4 additions and 0 deletions

View File

@ -773,6 +773,10 @@ DataModel.createUpdates = function(deltas, cb) {
tasks.push(function(cb) { tasks.push(function(cb) {
Model.findById(change.modelId, function(err, inst) { Model.findById(change.modelId, function(err, inst) {
if(err) return cb(err); if(err) return cb(err);
if(!inst) {
console.error('missing data for change:', change);
return callback();
}
if(inst.toObject) { if(inst.toObject) {
update.data = inst.toObject(); update.data = inst.toObject();
} else { } else {