MCPcopy Create free account
hub / github.com/reactjs/react-rails / captureCommitPhaseError

Function captureCommitPhaseError

lib/assets/react-source/development/react.js:26617–26653  ·  view source on GitHub ↗
(sourceFiber, error)

Source from the content-addressed store, hash-verified

26615 }
26616
26617 function captureCommitPhaseError(sourceFiber, error) {
26618 if (sourceFiber.tag === HostRoot) {
26619 // Error was thrown at the root. There is no parent, so the root
26620 // itself should capture it.
26621 captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
26622 return;
26623 }
26624
26625 var fiber = sourceFiber.return;
26626
26627 while (fiber !== null) {
26628 if (fiber.tag === HostRoot) {
26629 captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
26630 return;
26631 } else if (fiber.tag === ClassComponent) {
26632 var ctor = fiber.type;
26633 var instance = fiber.stateNode;
26634
26635 if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
26636 var errorInfo = createCapturedValue(error, sourceFiber);
26637 var update = createClassErrorUpdate(fiber, errorInfo, // TODO: This is always sync
26638 Sync);
26639 enqueueUpdate(fiber, update);
26640 var root = markUpdateTimeFromFiberToRoot(fiber, Sync);
26641
26642 if (root !== null) {
26643 ensureRootIsScheduled(root);
26644 schedulePendingInteractions(root, Sync);
26645 }
26646
26647 return;
26648 }
26649 }
26650
26651 fiber = fiber.return;
26652 }
26653 }
26654 function pingSuspendedRoot(root, thenable, suspendedTime) {
26655 var pingCache = root.pingCache;
26656

Callers 5

safelyDetachRefFunction · 0.85
safelyCallDestroyFunction · 0.85
commitRootImplFunction · 0.85
flushPassiveEffectsImplFunction · 0.85

Calls 8

createCapturedValueFunction · 0.85
createClassErrorUpdateFunction · 0.85
enqueueUpdateFunction · 0.85
ensureRootIsScheduledFunction · 0.85

Tested by

no test coverage detected