diff --git a/lib/proto.js b/lib/proto.js index 52f398b..5873397 100644 --- a/lib/proto.js +++ b/lib/proto.js @@ -181,7 +181,7 @@ exports.save = function(fn){ .send(self) .end(function(err, res){ if (err || res.error) - return fn(error(err,res), res); + return fn(self.error(err,res), res); if (res.body) self.primary(res.body[key]); self.dirty = {}; @@ -299,8 +299,3 @@ exports.toJSON = function(){ * @api private */ -function error(err, res) { - if (err) return err; - else return new Error('got ' + res.status + ' response'); -} -exports.error = error;