Skip to content

RESTAdapter invokes user-specified error callbacks. #87

wants to merge 1 commit into from

4 participants

vr-pair commented Feb 10, 2012

This PR allows users to specify an error handler that is invoked on server errors when records are created, updated or queried.

In the special case of a single record (create or update) with a status of 422, the record is invalidated with store.recordWasInvalid.


  error: function( jqXhr, textStatus, errorThrown, emberParams ) {
    // user-supplied error handling

/cc @hjdivad @Cyril-sf


We fixed a compatibility issue with Firefox 3.6, namely not passing extra arguments to the jQuery.ajax hash.

Ember.js member
tomdale commented Apr 19, 2012

The general thrust of this commit is good but I don't think it tackles the error handling on the correct level. In my opinion, error handling is a store-level concern and should not necessarily be handled solely in the adapter; the store should give the adapter an opportunity to correct the error, if needed, but that may not always be possible.

I'm gonna close this pull request for right now, but I think the ideas are headed in the right idea. Let me know if you guys would like to discuss this in more detail to get it to a point we can merge. Thanks!

@tomdale tomdale closed this Apr 19, 2012
Ember.js member
hjdivad commented Apr 19, 2012

@tomdale would love to discuss this PR to get it mergeable. From our POV we need a hook to catch general errors (usually 500s), and something to put the errors on the right models when server side validation fails.

What's the sketch of a pull request you'd be happy with that addresses these two concerns?

Ember.js member
tomdale commented Apr 19, 2012

@hjdivad Want to hit me up on Gchat and we can discuss in more depth? [firstname]@[firstname][lastname].net.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.