-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactored InvalidError handling into a serializer concern. #2392
Conversation
❤️ |
Refactored InvalidError handling into a serializer concern.
👍 |
😍 😍 😍 |
normalizeErrors: function(type, hash) { | ||
this.normalizeId(hash); | ||
this.normalizeAttributes(type, hash); | ||
this.normalizeRelationships(type, hash); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: #3017
🎆 Thanks! |
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.