-
Notifications
You must be signed in to change notification settings - Fork 142
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
Replace status with boolean error field #6
Comments
Please describe what value would a restriction to a boolean provide over being any truthy/falsy value? |
Disadvantages:
|
@clearjs Any false-y value should be interpreted as success, including null, undefined, etc. Only |
Good. Then why not go one step further, and allow any truthy value as well? For example, an error object. |
I would keep the error object in the payload. That way you don't get into a situation where an action has both a payload and an error object. |
@acdlite I think I've addressed that here: #4 (comment) Also, your situation would work just fine with what I propose: |
By the way, sorry if my tone looks harsh or like I have hard feeling with respect to the outcome, both here and elsewhere. That isn't the intention at all. I'm being a bit pedantic trying to clarify the motivation and making sure that most aspects have been considered. |
An action with |
@clearjs No problem, same goes for me! :) |
Changed in v0.6.0 |
Please continue any discussion over here: #7 |
@acdlite looks like your last comment was intended for some other issue. |
Haha thanks! |
Just a minor note: if we're going with a boolean flag, woudn't be better |
I know this is an old issue, and it seems like the dust has already settled a bit, but I have a concern about errors in the FSA spec: In the case of an error, the entire action For example, if I am a developer and I have an Likewise, if the The only solutions currently allowed by the spec (that I can see) are adding the My proposed solution is to change the spec from:
to something like the following:
This is obviously a breaking change for code using the current spec; it would require error handling middleware to mirror the payload object with an additional Ex: And in addition, the handler of the action would have to access the error object via However, the result would be much friendlier to Flux developers in my opinion. |
I dont see much value in having both If we relaxed the dispatch({
...prevAction
error: {
message: "Error saving user"
}
}); |
Perfect. That idea also came to me before bed last night -- seems much simpler than requiring both, and it allows us to use the payload for other things :) |
I realized after posting that there was previous discussion about making |
There's been a lot of confusion about
status
and its purpose. You can read some of the reasoning behind it here: #4 (comment)I propose we replace
status
with a booleanerror
field. Iferror
is true, then the action represents an error, and the payload should (by convention, like with rejected promises) be an error.The text was updated successfully, but these errors were encountered: