-
Notifications
You must be signed in to change notification settings - Fork 0
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
Groovy Global Response Handler #11
Labels
Comments
umairabid-tkxel
added a commit
that referenced
this issue
Dec 4, 2014
3 tasks
umairabid-tkxel
added a commit
that referenced
this issue
Dec 5, 2014
Something to keep in mind: http://emberjs.com/guides/routing/loading-and-error-substates/#toc_the-code-error-code-event |
umairabid-tkxel
added a commit
that referenced
this issue
Dec 9, 2014
umairabid-tkxel
added a commit
that referenced
this issue
Dec 11, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's begin this task with an abstract discussion leading to a high level proposed solution. There are many moving parts that this will depend on, for now we can assume they will be implemented separately or in tandem. See examples at the bottom to get an idea of concrete situations this will apply to.
Purpose
The purpose of this task is to unify and make sense of the various ways responses can enter the Ember application. Furthermore, deciding what kind of actions should be taken and how they will be achieved. Much of the important work here will be simply deciding on (and enforcing) the format of the various messages (usually in
json
) being passed to the app.A note on I18n
Don't forget we're going to implementing I18n soon on the API side and pass locale information to the Ember side by request. This needs to be taken into account when architecting a solution here.
Behold!
A)
What format will errors sent from the api take? Currently there is a makeshift format in place, something like:
{"error": {"some_object": "something bad happened"}}
. This isn't so bad, but we need to make sure it doesn't miss anything.Some questions:
B)
I imagine this piece will be the core of whatever code comes out of this task, probably a mixin or something similar. We need to create some sort of library to process a message and make decisions on how it should be displayed by Ember given these sorts of attributes:
C)
Given a particular message, how should it be displayed given the current context and contents of the message? What possible display methods will be supported?
This piece overlaps a lot with E.
D)
There will be certain situations where messages should trigger some sort of action on the Ember side. This will most likely be handled on a case-by-case basis and does not need a "general" implementation, however there should be a spot reserved for this.
E)
This part should mostly deal with naming conventions that can be relied upon when building forms. For example, an error on
email
field might set another fieldemailError
totrue
andemailErrorMessage
to "Bad email!!".Assuming a separate piece of code that processes form input and generates
success
/failure
of validation/processing of that form, based on the response object we can:F)
Like API messages (A), we need to decide on a particular format for Pusher messages and how they will be parsed. These messages normally come from async operations but their content can be anything we want.
G)
Any other sorts of messages/responses we might want to account for?
Examples Scenarios
Entry
is sent for savingEntry
processed and score (success/failure)Entry
form after login has expiredLogin Errors (should cover all
error-group
s)Sub tasks
Ember.Controller
and include the mixininline
errors responsefooError
error-group
v1_bla
thing in user loginThe text was updated successfully, but these errors were encountered: