fix(proxy): handle error when proxy itself errors #13929
Merged
+11
−2
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.
Description
closes #13703
Add error handling to the point when the proxy itself errors.
Right now, the
proxy
expects that theres
is neverundefined
or other falsy value but there are some cases when theres
is.When the
res
is falsy, the thrown error becomes the error of accessingundefined
value, not the original error.This makes it hard for developers to trace the original error.
Therefore, I added a logic to handle error case when the
res
is falsy.Additional context
My particular case of the problem was passing
server.proxy
'starget
as falsy value (null
orundefined
).AS-IS
Just seeing the error above, it is hard to track where the error started from.
TO-BE
The above error can give developers more specific information about where the error started from.
I believe that my fix can cover so much more errors. Due to the fact that it is caused by an incorrect expectation of the type of
res
.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).