[suspense][error handling] Add failing unit test #16800
Closed
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.
Covers an edge case where an error is thrown inside the complete phase of a component that is in the return path of a component that suspends. The second error should also be handled (i.e. able to be captured by an error boundary.
The test is currently failing because there's a call to
completeUnitOfWork
inside the main render phasecatch
block. That call is not itself wrapped in try-catch, so anything that throws is treated as a fatal/unhandled error.I believe this bug is only observable if something in the host config throws; and, only in legacy mode, because in concurrent/batched mode,
completeUnitOfWork
on fiber that throws follows the "unwind" path only, not the "complete" path, and the "unwind" path does not call any host config methods.I have a fix, but it overlaps with a refactoring PR that I'm also working on, so I'm going to stack it on top of that.