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

Refactored InvalidError handling into a serializer concern. #2392

Merged
merged 1 commit into from
Oct 16, 2014

Conversation

ahacking
Copy link
Contributor

Refactored InvalidError handling into a serializer concern.

Addresses #1977 by ensuring error keys undergo the same mapping treatment that model attribute and relationship keys do.

Supports #1984 and #1877 by moving the model error serialization concern into the serializer. This PR should remove any objections for not applying all errors which have been sanctioned by the serializer to the record/model errors.

Paves the way for embedded record error handling, with the intent that errors can be mapped/normalized for the specific embedded records to which they apply.

@igorT
Copy link
Member

igorT commented Oct 16, 2014

❤️

igorT added a commit that referenced this pull request Oct 16, 2014
Refactored InvalidError handling into a serializer concern.
@igorT igorT merged commit cd12a3b into emberjs:master Oct 16, 2014
@fsmanuel
Copy link
Contributor

👍

@joostdevries
Copy link

😍 😍 😍

normalizeErrors: function(type, hash) {
this.normalizeId(hash);
this.normalizeAttributes(type, hash);
this.normalizeRelationships(type, hash);

Choose a reason for hiding this comment

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

Hey @ahacking,

We're updating our app to latest Ember-Data and we've been having issues in our error processing because of this. When using polymorphic relationships, normalizeRelationships will inspect the hash for a type property. Since this is an error payload, the type property won't be set.

Here's a workaround implementation which works great for us. Do you see any issue with it? I'm thinking of opening a PR with it.

Copy link
Member

Choose a reason for hiding this comment

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

Can you open an issue for this please as well, just so we can track it

Choose a reason for hiding this comment

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

Done: #3017

@quaertym
Copy link

🎆 Thanks!

jbourassa pushed a commit to didacte/data that referenced this pull request May 11, 2015
jbourassa pushed a commit to didacte/data that referenced this pull request May 11, 2015
jbourassa pushed a commit to didacte/data that referenced this pull request May 11, 2015
jbourassa pushed a commit to didacte/data that referenced this pull request May 29, 2015
jbourassa pushed a commit to didacte/data that referenced this pull request May 29, 2015
jbourassa pushed a commit to didacte/data that referenced this pull request Jun 10, 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.

6 participants