Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
issue#2609 | Sasha | predictable axios requests #2702
issue#2609 | Sasha | predictable axios requests #2702
Changes from 1 commit
1e4352a
4be5d6d
29d13dd
e1c2fb0
cfb8d6e
d73ff66
703bb26
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
As
runWhen
is executed immediately, we need to try/catch of it.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.
I'm a bit confused on this one. What do we want to do in the catch if the
runWhen
function fails? The function is provided by the consumer so we don't know what kind of errors it might throw. I would think we just want the program to fail at that point.The axios configuration accepts other consumer provided functions such as
validateStatus
andparamsSerializer
. Calls to those functions are not wrapped in try/catch blocks.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.
@chinesedfan @SashaKoro Here is the bug of issue #4036! The concat method does not change the existing arrays, but instead returns a new array. It cause response interceptors not append into chain!
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.
Yes, but it has been fixed in #4013 and released in v0.21.3.
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.
If
onRejected
had solved the error, we should continue the loop. If not, should drop to the nextonRejected
.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.
Hmm, this would make the functionality different from the
asynchronous
behavior then.When we have async interceptors we do a promise chain:
promise = promise.then(chain.shift(), chain.shift());
When any interceptor throws in a chained promise, the whole thing errors out.
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.
@SashaKoro Sorry for my long long latency. I mean,
Even though the chain has an error, but
f2
can resolve it and make the loop go on.