Handling errors with Ember Data using the JSON API standard

I am struggling to handle an errors response using Ember Data and the ActiveModelAdapter. I have Googled around and the consensus is that the json format needs to be {errors: {field_name: [“My error message”, “another error”]}} but although I am returning this in a HTTP 500 response my model’s “errors” property remains an empty Ember object.

Also, from what I have read Ember Data is compatible with the JSON API standard (created by Ember’s Yehuda Katz) so I’d like to return errors in the following format if possible:

http://jsonapi.org/format/#errors

This would allow me to return a “title”, “code” etc. However, all of the examples that I can find of Ember Data handling errors do not demonstrate this format being used and they seem to limit the error format to a field name key and one or more message strings. Am I mistaken in thinking that the ActiveModelAdapter can handle this type of response?

If anyone could help me with this I’d be grateful.

Thanks.


Source: json

Leave a Reply