diff --git a/backbone.js b/backbone.js index d3c3b9b3..4645a0ad 100644 --- a/backbone.js +++ b/backbone.js @@ -427,7 +427,7 @@ if (success) success(model, resp, options); model.trigger('sync', model, resp, options); }; - options.error = wrapError(this, options); + wrapError(this, options); return this.sync('read', this, options); }, @@ -474,7 +474,7 @@ if (success) success(model, resp, options); model.trigger('sync', model, resp, options); }; - options.error = wrapError(this, options); + wrapError(this, options); method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update'); if (method === 'patch') options.attrs = attrs; @@ -508,7 +508,7 @@ options.success(); return false; } - options.error = wrapError(this, options); + wrapError(this, options); var xhr = this.sync('delete', this, options); if (!options.wait) destroy(); @@ -830,7 +830,7 @@ if (success) success(collection, resp, options); collection.trigger('sync', collection, resp, options); }; - options.error = wrapError(this, options); + wrapError(this, options); return this.sync('read', this, options); }, @@ -1503,7 +1503,7 @@ // Wrap an optional error callback with a fallback error event. var wrapError = function (model, options) { var error = options.error; - return function(resp) { + options.error = function(resp) { if (error) error(model, resp, options); model.trigger('error', model, resp, options); };