Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Ember data, jsonapi spec and errors

$
0
0

@therealbenhogan wrote:

Hi all,

I am trying to return an error object from my api - for a situation, where for example there are no results returned for a query.

This is the type of error object I am returning:

 {"errors":[{"status":"422"}]}

This complies with recommendation set out in jsonapi.org spec (I hope!)

The error I get back from ember when I go to a page which will generate such an error is

Error: Assertion Failed: Expected an object in the 'data' property in a call to 'push' for undefined, but was undefined

I have also tried returning

{"data":{"errors":[{"status":"422"}]}}

But when I do that I get

Error: Assertion Failed: Encountered a resource object with an undefined type

Any ideas much appreciated!

Using Ember 2.4.2, Ember Data 2.4.0

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles