MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / throwException

Function throwException

code/new-context-api/public/app.js:10362–10405  ·  view source on GitHub ↗
(returnFiber, sourceFiber, rawValue)

Source from the content-addressed store, hash-verified

10360
10361
10362 function throwException(returnFiber, sourceFiber, rawValue) {
10363 // The source fiber did not complete.
10364 sourceFiber.effectTag |= Incomplete;
10365 // Its effect list is no longer valid.
10366 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
10367
10368 var value = createCapturedValue(rawValue, sourceFiber);
10369
10370 var workInProgress = returnFiber;
10371 do {
10372 switch (workInProgress.tag) {
10373 case HostRoot:
10374 {
10375 // Uncaught error
10376 var errorInfo = value;
10377 ensureUpdateQueues(workInProgress);
10378 var updateQueue = workInProgress.updateQueue;
10379 updateQueue.capturedValues = [errorInfo];
10380 workInProgress.effectTag |= ShouldCapture;
10381 return;
10382 }
10383 case ClassComponent:
10384 // Capture and retry
10385 var ctor = workInProgress.type;
10386 var _instance = workInProgress.stateNode;
10387 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
10388 ensureUpdateQueues(workInProgress);
10389 var _updateQueue = workInProgress.updateQueue;
10390 var capturedValues = _updateQueue.capturedValues;
10391 if (capturedValues === null) {
10392 _updateQueue.capturedValues = [value];
10393 } else {
10394 capturedValues.push(value);
10395 }
10396 workInProgress.effectTag |= ShouldCapture;
10397 return;
10398 }
10399 break;
10400 default:
10401 break;
10402 }
10403 workInProgress = workInProgress['return'];
10404 } while (workInProgress !== null);
10405 }
10406
10407 function unwindWork(workInProgress) {
10408 switch (workInProgress.tag) {

Callers 1

renderRootFunction · 0.70

Calls 3

createCapturedValueFunction · 0.70
ensureUpdateQueuesFunction · 0.70

Tested by

no test coverage detected