-
-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Friendly Errors #101
Friendly Errors #101
Conversation
👍 |
It would be neat to provide something like Rail's |
a start emberjs/data#3862 |
Hi @nikz. I like this rfc a lot. Would you like to open a pr on the Ember Data repo where we can iterate on the implementation of the |
export default ActiveModelAdapter.extend({ | ||
|
||
ajax(url, method) { | ||
this.lastRequest = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This technique may not work with multiple concurrent ajax requests. Instead I suspect we will need to pass the request or errorMessage as an argument to handleResponse
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, mostly a hack to avoid trying to drop too deeply into the ember-data
code. Definitely better ways to do it!
@bmac awesome! I will do so over the weekend and cc you :) |
Assigned an RFC number and merged in 6157685 @nikz's PR in emberjs/data#3930 was the implementation. Thank you so much! |
I really like the idea of this RFC. However I also hold out hope that an AdapterError could hold an actual data payload.. for those of us that might receive an array of errors or a hash of error parameters? rather than (read: in addition too) just a serialized string of info? |
@grapho Hiya! Remember this is just the default handler if you haven't specified anything else, mostly for debugging and error tracking. If you use a blob of JSON then that'll be spit out, or if you're looking for more model validation things then a JSON API "errors" payload would work best. |
@nikz yeah oops, i momentarily forgot that error payload can already get passed in... just ignore me ;) |
Hopefully I filled out everything correctly.
Thanks for looking at this! 😎
Here's a wee "friendly error" preview: