diff --git a/lib/persisted-model.js b/lib/persisted-model.js index f1df2656..36e84b30 100644 --- a/lib/persisted-model.js +++ b/lib/persisted-model.js @@ -976,13 +976,15 @@ function tryReplicate(sourceModel, targetModel, since, options, callback) { function checkpoints() { var cb = arguments[arguments.length - 1]; sourceModel.checkpoint(function(err, source) { + if (err) return cb(err); newSourceCp = source.seq; targetModel.checkpoint(function(err, target) { + if (err) return cb(err); newTargetCp = target.seq; debug('\tcreated checkpoints'); debug('\t\t%s for source model %s', newSourceCp, sourceModel.modelName); debug('\t\t%s for target model %s', newTargetCp, targetModel.modelName); - cb(err); + cb(); }); }); }