fix(ext/flash): Correctly handle errors for chunked responses #17303
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.
The leading cause of the problem was that
handleResponse
hastryRespondChunked
passed as an argument, which in turn is implemented as a call tocore.ops.op_try_flash_respond_chuncked
, that throws in the repro code.handleResponse
was not handled correctly, as it not returned any value, and had nocatch
attached to it.It also effectively was never correctly handled inside two other blocks with
resp.then
andPromisePrototypeCatch(PromisePrototypeThen(resp, "..."))
as well, as it just short-circuited the promise with an empty resolve, instead of relying on the last(async () => {})
block.This change makes
handleResponse
return a correct value and attachonError
handler to the "non-thenable" variant of response handling code.continue
s are redundant, as there are no unhandled branches within thefor
loop at line 540.Repro from #17291
Before:
After:
Fixes #17291