Documentation on expected errors payload?
See original GitHub issueIām running into an issue where my errors response is not as I expect, but I canāt find any documentation on what the expected format is supposed to be.
Currently, my errors response is formatted like this (JSONAPI spec, I guess):
{
errors: [
"Error message"
]
}
But the error response from my ajax request makes it look like an array of objects.

I really just donāt know how I am supposed to work with the errors object because I canāt find any documentation about it.
this.get('ajax').post('endpoint', payload).then(success).catch(function(e){
console.error("errors", e.errors); // looks like an array of objects
console.error("messages", e.errors.messages); // undefined
console.error(e.errors.join('. ')); // [Object object].
});
``
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:18 (3 by maintainers)
Top Results From Across the Web
Exception payload / error handling - Google Groups
I am asking since I would expect different types of clients to handle one format better than another. For instance, I don't expect...
Read more >Error message contains whole payload when the type is not ...
I tried to send (wrongly) a string using POST /indexes/x/documents . The returned error message from MeiliSearch is as follows:
Read more >Troubleshooting payload deployment issues
Error occurs when you run arpayloaddeploymentutil.bat. The status of Deployment Payload entries is stuck in Waiting For Utility Run.
Read more >Error handling - Apollo GraphQL Docs
Making errors actionable on the client and server Ā· Built-in error codes Ā· Custom errors Ā· Throwing errors Ā· Omitting or including stacktrace...
Read more >Mule Errors | MuleSoft Documentation
You can then gain access to error message attributes (metadata) and to the payload itself with #[error.errorMessage.payload] for the payload and #[error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@wasabigeek Iāll make sure to cover that in my documentation. The best approach would be to make your own sub-class of the
ajax
service (so, make your own service, import theAjaxService
and extend from that) and then overwrite thenormalizeErrorResponse
method to do something like this (no guarantees that this exact code would work, though; this is just off the top of my head)This should set things up so that the
AjaxError
class receives the format that itās expecting.If thereās any suggestions on how we could make this easier, I would love to hear them! The idea is for
ember-ajax
to be extensible for exactly this purpose, and I realize the docs arenāt great right now. Iām working on it!In which case that sounds perfect to me š