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

[WIP] json api errors #3194

Merged
merged 1 commit into from
Jun 16, 2015
Merged

[WIP] json api errors #3194

merged 1 commit into from
Jun 16, 2015

Conversation

tchak
Copy link
Member

@tchak tchak commented Jun 4, 2015

This PR normalize internal representation of errors in ember data. It will align the representation of errors with json api spec errors

It do not change public api (errors object) for invalid errors

  • fix current tests
  • add more tests
  • fix documentation (work in progress)

We are deprecating ajaxSuccess and ajaxError in favor of handleRequest. The main goal is to decouple RESTAdapter from jQuery.ajax.

if (status === 422) {
var errors = [];

Object.keys(payload.errors).forEach(function(key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably check if payload.errors is there or not

@tchak tchak force-pushed the json-api-errors branch 4 times, most recently from 5385889 to 7fe469d Compare June 10, 2015 22:39
@tchak tchak force-pushed the json-api-errors branch 24 times, most recently from 4c91a8f to 8b8f6b3 Compare June 16, 2015 16:53
export function errorsHashToArray(errors) {
let out = [];

if (Ember.isPresent(errors)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably use Ember.keys + a for loop

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@fivetanley
Copy link
Member

lgtm

@stefanpenner
Copy link
Member

Lgtm

igorT added a commit that referenced this pull request Jun 16, 2015
@igorT igorT merged commit dd672e2 into emberjs:master Jun 16, 2015
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

5 participants