I'm writing my own JSONAPISerializer and am struggling to figure out how to gracefully return null / empty object after findRecord comes back as invalid.
I'm checking to make sure the response contains the object. If it doesn't I'd like to just return null, but ember gives me the error Cannot read property '_internalModel' of null
.
If I return an empty array I get the error Ember Data expected the primary data returned from a findRecord response to be an object but instead it found an array.
And if I return anything else I get data must be null, an object, or an array
The issue with all of these errors is that program execution stops. Is there no way to fail gracefully when a findRecord request is invalid?
Aucun commentaire:
Enregistrer un commentaire