Skip to content
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

What is the reasoning for a Request FSA with error flag? (vs a Failure FSA) #44

Closed
barrystaes opened this issue Feb 17, 2016 · 6 comments
Labels

Comments

@barrystaes
Copy link
Contributor

As i understand now - when a REQUEST FSA gets fired, this can result in a:

  • REQUEST FSA with error flag (for example when the API request cant be made)
  • SUCCESS FSA (for example for API response 200 OK)
  • FAILURE FSA (for example for API response 404 Not Found)

But in my view one REQUEST FSA should result in (only and) exactly one FSA, either SUCCESS or FAILURE.

I haven't actually used it, but i dont really understand the first one. Whats the argument for not returning a FAILURE FSA in that case?

@barrystaes barrystaes changed the title REQUEST FSA can result in REQUEST FSA with error flag Request FSA can result in Request FSA with error flag (why not Failure FSA?) Feb 17, 2016
@barrystaes barrystaes changed the title Request FSA can result in Request FSA with error flag (why not Failure FSA?) What is the reasoning for a Request FSA with error flag? (vs a Failure FSA) Feb 17, 2016
@agraboso
Copy link
Owner

@barrystaes This is an issue that I struggled with — see this comment of mine. The solution that I came up with might not be to everyone's taste nor even the most logical one. I think a thorough discussion is in order before we push out a v2.

@agraboso
Copy link
Owner

Pinging #26, since it is relevant to this issue.

@aris-b
Copy link

aris-b commented Apr 25, 2016

I am also confused. When I get an API request error like this :

{ 
 [RequestError: request to https://xxxxx failed, reason: self signed certificate]
 name: 'RequestError',
 message: 'request to https://xxxx failed, reason: self signed certificate' },
 meta: undefined,
 error: true }

The FAILURE FSA is not triggered. I see this error by logging on REQUEST FSA.
So my question is, when actually FAILURE FSA gets triggered ?

@danludwig
Copy link

danludwig commented May 9, 2016

Found this when searching for how to customize the action payload when a REQUEST FSA is dispatched with an error flag. Seems you can't? For example, if I attach a key property to the initial REQUEST payload, there is no way to correlate that key's value back to the request that failed?

@barrystaes
Copy link
Contributor Author

barrystaes commented May 17, 2016

So my question is, when actually FAILURE FSA gets triggered ?

@aris-b a FAILURE FSA is triggered when the response is not 200 OK, and if the response was 200 OK expect a SUCCESS FSA.
If the request could not be made at all, expect a REQUEST FSA with error:true. This behavior is documented at lifecycle in readme.md and its also outlined in the first post of this issue..

@danludwig Have you looked into using the meta property, which is there for the purpose of adding metadata to use later.

nason added a commit to nason/redux-api-middleware that referenced this issue Mar 3, 2018
Previously:

RSAA -> Request FSA -> Request Error FSA

Now:

RSAA -> Request FSA -> Failure FSA

Closes agraboso#26 agraboso#44 agraboso#99
nason added a commit that referenced this issue Mar 3, 2018
Previously:

RSAA -> Request FSA -> Request Error FSA

Now:

RSAA -> Request FSA -> Failure FSA

Closes #26 #44 #99
nason added a commit that referenced this issue Jun 10, 2018
Previously:

RSAA -> Request FSA -> Request Error FSA

Now:

RSAA -> Request FSA -> Failure FSA

Closes #26 #44 #99
nason added a commit that referenced this issue Jun 10, 2018
Previously:

RSAA -> Request FSA -> Request Error FSA

Now:

RSAA -> Request FSA -> Failure FSA

Closes #26 #44 #99
@iamandrewluca
Copy link
Collaborator

Fixed in #175

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants