Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle some create and update errors in the REST adapter. #476

Merged
merged 1 commit into from Nov 20, 2012

Conversation

pivotal-medici
Copy link

  • 422 Unprocessable Entity

    Transitions the record to the invalid state. Assumes
    the server has responded with {errors: {...}} and
    sets them on the record.

  • All other status codes

    Transitions the record to the error state.

This is limited to only single, non-bulk creates/updates.

@pivotal-medici
Copy link
Author

Not sure why Travis failed there. The whole test suite works for us in the browser and from the command line.

@mspisars
Copy link
Contributor

It is actually failing jshint because of another commit: 90c253d
https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/serializer.js#L601
key is not defined for both the _addBelongsTo and _addHasMany

@wagenet
Copy link
Member

wagenet commented Nov 15, 2012

This seems fine but I think we were planning for something more comprehensive to do error handling. Nevertheless, this might be ok in the short term. @wycats?

Also, the JSHint failure has been fixed.

@wycats
Copy link
Member

wycats commented Nov 19, 2012

@elliterate if you DRY up the error callback, this looks good to go.

* 422 Unprocessable Entity

  Transitions the record to the invalid state. Assumes
  the server has responded with `{errors: {...}}` and
  sets them on the record.

* All other status codes

  Transitions the record to the error state.

This is limited to only single, non-bulk creates/updates.
@pivotal-medici
Copy link
Author

The error callback is now DRY.

@tomdale
Copy link
Member

tomdale commented Nov 20, 2012

programming

tomdale added a commit that referenced this pull request Nov 20, 2012
Handle some create and update errors in the REST adapter.
@tomdale tomdale merged commit 36a70c9 into emberjs:master Nov 20, 2012
@ryanjm
Copy link

ryanjm commented Apr 25, 2013

Is there plans (soon) to add support for 422 (?) on deletes? How should it be handled if an object shouldn't be allowed to be deleted?

@madadam
Copy link
Contributor

madadam commented Apr 25, 2013

If the object is not allowed to be deleted, wouldn't 403 be more appropriate response?

@ryanjm
Copy link

ryanjm commented Apr 25, 2013

You are right. 403 would be better.

On Apr 25, 2013, at 3:12 PM, "Adam Cigánek" notifications@github.com
wrote:

If the object is not allowed to be deleted, wouldn't 403 be more
appropriate response?


Reply to this email directly or view it on
GitHubhttps://github.com//pull/476#issuecomment-17039201
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants