Permalink
Browse files

only need one error callback

  • Loading branch information...
1 parent dcd05dd commit 458bd914ffb861a89cfca9df414af5c18c31c28f @aheckmann aheckmann committed Oct 14, 2011
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/document.js
View
@@ -776,19 +776,17 @@ Document.prototype._registerHooks = function () {
--subdocs || next();
}
});
- });
});
- }, function (err) {
- this.db.emit('error', err);
+ });
+ }, function (err) {
+ this.db.emit('error', err);
}).pre('save', function checkForExistingErrors (next) {
if (self._saveError){
next(self._saveError);
self._saveError = null;
} else {
next();
}
- }, function (err) {
- this.db.emit('error', err);
}).pre('save', function validation (next) {
return self.validate.call(self, next);
});

0 comments on commit 458bd91

Please sign in to comment.