MCPcopy Index your code
hub / github.com/microsoft/SandDance / handleError

Function handleError

docs/external/js/react-dom.development.js:22113–22156  ·  view source on GitHub ↗
(root, thrownValue)

Source from the content-addressed store, hash-verified

22111 }
22112
22113 function handleError(root, thrownValue) {
22114 do {
22115 try {
22116 // Reset module-level state that was set during the render phase.
22117 resetContextDependencies();
22118 resetHooksAfterThrow();
22119 resetCurrentFiber();
22120
22121 if (workInProgress === null || workInProgress.return === null) {
22122 // Expected to be working on a non-root fiber. This is a fatal error
22123 // because there's no ancestor that can handle it; the root is
22124 // supposed to capture all errors that weren't caught by an error
22125 // boundary.
22126 workInProgressRootExitStatus = RootFatalErrored;
22127 workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next
22128 // sibling, or the parent if there are no siblings. But since the root
22129 // has no siblings nor a parent, we set it to null. Usually this is
22130 // handled by `completeUnitOfWork` or `unwindWork`, but since we're
22131 // interntionally not calling those, we need set it here.
22132 // TODO: Consider calling `unwindWork` to pop the contexts.
22133
22134 workInProgress = null;
22135 return null;
22136 }
22137
22138 if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
22139 // Record the time spent rendering before an error was thrown. This
22140 // avoids inaccurate Profiler durations in the case of a
22141 // suspended render.
22142 stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
22143 }
22144
22145 throwException(root, workInProgress.return, workInProgress, thrownValue, renderExpirationTime$1);
22146 workInProgress = completeUnitOfWork(workInProgress);
22147 } catch (yetAnotherThrownValue) {
22148 // Something in the return path also threw.
22149 thrownValue = yetAnotherThrownValue;
22150 continue;
22151 } // Return to the normal work loop.
22152
22153
22154 return;
22155 } while (true);
22156 }
22157
22158 function pushDispatcher(root) {
22159 var prevDispatcher = ReactCurrentDispatcher$1.current;

Callers 2

performSyncWorkOnRootFunction · 0.85

Calls 6

resetContextDependenciesFunction · 0.85
resetHooksAfterThrowFunction · 0.85
resetCurrentFiberFunction · 0.85
throwExceptionFunction · 0.85
completeUnitOfWorkFunction · 0.85

Tested by

no test coverage detected