(root, thrownValue)
| 26310 | } |
| 26311 | |
| 26312 | function handleError(root, thrownValue) { |
| 26313 | do { |
| 26314 | var erroredWork = workInProgress; |
| 26315 | |
| 26316 | try { |
| 26317 | // Reset module-level state that was set during the render phase. |
| 26318 | resetContextDependencies(); |
| 26319 | resetHooksAfterThrow(); |
| 26320 | resetCurrentFiber(); // TODO: I found and added this missing line while investigating a |
| 26321 | // separate issue. Write a regression test using string refs. |
| 26322 | |
| 26323 | ReactCurrentOwner$2.current = null; |
| 26324 | |
| 26325 | if (erroredWork === null || erroredWork.return === null) { |
| 26326 | // Expected to be working on a non-root fiber. This is a fatal error |
| 26327 | // because there's no ancestor that can handle it; the root is |
| 26328 | // supposed to capture all errors that weren't caught by an error |
| 26329 | // boundary. |
| 26330 | workInProgressRootExitStatus = RootFatalErrored; |
| 26331 | workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next |
| 26332 | // sibling, or the parent if there are no siblings. But since the root |
| 26333 | // has no siblings nor a parent, we set it to null. Usually this is |
| 26334 | // handled by `completeUnitOfWork` or `unwindWork`, but since we're |
| 26335 | // intentionally not calling those, we need set it here. |
| 26336 | // TODO: Consider calling `unwindWork` to pop the contexts. |
| 26337 | |
| 26338 | workInProgress = null; |
| 26339 | return; |
| 26340 | } |
| 26341 | |
| 26342 | if (enableProfilerTimer && erroredWork.mode & ProfileMode) { |
| 26343 | // Record the time spent rendering before an error was thrown. This |
| 26344 | // avoids inaccurate Profiler durations in the case of a |
| 26345 | // suspended render. |
| 26346 | stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true); |
| 26347 | } |
| 26348 | |
| 26349 | if (enableSchedulingProfiler) { |
| 26350 | markComponentRenderStopped(); |
| 26351 | |
| 26352 | if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') { |
| 26353 | var wakeable = thrownValue; |
| 26354 | markComponentSuspended(erroredWork, wakeable, workInProgressRootRenderLanes); |
| 26355 | } else { |
| 26356 | markComponentErrored(erroredWork, thrownValue, workInProgressRootRenderLanes); |
| 26357 | } |
| 26358 | } |
| 26359 | |
| 26360 | throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes); |
| 26361 | completeUnitOfWork(erroredWork); |
| 26362 | } catch (yetAnotherThrownValue) { |
| 26363 | // Something in the return path also threw. |
| 26364 | thrownValue = yetAnotherThrownValue; |
| 26365 | |
| 26366 | if (workInProgress === erroredWork && erroredWork !== null) { |
| 26367 | // If this boundary has already errored, then we had trouble processing |
| 26368 | // the error. Bubble it to the next boundary. |
| 26369 | erroredWork = erroredWork.return; |
no test coverage detected
searching dependent graphs…