Using Ember and Ember-data, I work against an API that I don't control.
In a very specific case, it returns an apparently valid response (status 200), that turns out to be not that useful after inspecting it. However, this response is complex, and it's not until the serializer that I can realize this.
Therefore, the question: is there a way to return an error to the client (something similar to what a 404 response would do) from the serializer?
If the above is not possible, I have alternative ideas:
- Add code in the adapter that checks this complex response before handing it over to the serializer (this would introduce some annoying duplication and mixing of concerns)
- Return a null object of some kind, and have the client deal with that. I could have a service in between the client code and store, and have it doing this work to protect the client
Any other alternative ideas? Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire