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

Function throwException

code/controlled-uncontrolled/public/app.js:10325–10368  ·  view source on GitHub ↗
(returnFiber, sourceFiber, rawValue)

Source from the content-addressed store, hash-verified

10323
10324
10325 function throwException(returnFiber, sourceFiber, rawValue) {
10326 // The source fiber did not complete.
10327 sourceFiber.effectTag |= Incomplete;
10328 // Its effect list is no longer valid.
10329 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
10330
10331 var value = createCapturedValue(rawValue, sourceFiber);
10332
10333 var workInProgress = returnFiber;
10334 do {
10335 switch (workInProgress.tag) {
10336 case HostRoot:
10337 {
10338 // Uncaught error
10339 var errorInfo = value;
10340 ensureUpdateQueues(workInProgress);
10341 var updateQueue = workInProgress.updateQueue;
10342 updateQueue.capturedValues = [errorInfo];
10343 workInProgress.effectTag |= ShouldCapture;
10344 return;
10345 }
10346 case ClassComponent:
10347 // Capture and retry
10348 var ctor = workInProgress.type;
10349 var _instance = workInProgress.stateNode;
10350 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
10351 ensureUpdateQueues(workInProgress);
10352 var _updateQueue = workInProgress.updateQueue;
10353 var capturedValues = _updateQueue.capturedValues;
10354 if (capturedValues === null) {
10355 _updateQueue.capturedValues = [value];
10356 } else {
10357 capturedValues.push(value);
10358 }
10359 workInProgress.effectTag |= ShouldCapture;
10360 return;
10361 }
10362 break;
10363 default:
10364 break;
10365 }
10366 workInProgress = workInProgress['return'];
10367 } while (workInProgress !== null);
10368 }
10369
10370 function unwindWork(workInProgress) {
10371 switch (workInProgress.tag) {

Callers 1

renderRootFunction · 0.70

Calls 3

createCapturedValueFunction · 0.70
ensureUpdateQueuesFunction · 0.70

Tested by

no test coverage detected