title: How to call ".done" after the ajax call in Backbone fetch calls
body: <p>Instead of throwing an error, the RESTful API that I call returns 200 success with a "fault" object as part of the return data when there's an error server side. I can't change the API. To handle this (without Backbone) all ajax calls are wrapped in a class that calls ".done" after the ajax call to handle display of any "fault" that may be included in the response. Also, some callers need to be able to specify settings that indicate where the fault should be displayed, while others rely on the default location.</p>
  
  <p>I want to change the code to use Backbone's sync functionality to save and retrieve my models and collections, but I'm not sure how to inject the desired settings values and .done function. I could override the prototype sync method and change it to call our custom ajax method, but it's a pretty involved function and I'm rather afraid I'd break something. I would much rather find some lighter way to call ".done" on the result of the ajax call, but I'm having difficulty figuring out how. </p>
  
  <p>I see how to inject an additional error handler or success handler by overriding Backbone.Model.prototype.fetch and Backbone.Collection.prototype.fetch, per this post - <a href="https://stackoverflow.com/questions/13673109/how-to-add-a-default-error-handler-to-all-backbone-models">How to add a default error handler to all Backbone models?</a>. However, that doesn't give me direct access to the actual ajax call return so I don't have anything to call ".done" on, plus "fetch" only covers "get" ajax calls and I need to handle faults for all Backbone ajax calls. </p>
  
  <p>Anyone have an idea how to handle this?</p>
  
  <p>Thanks much!</p>