MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / commitErrorLogging

Function commitErrorLogging

code/redux/public/app.js:11589–11638  ·  view source on GitHub ↗
(finishedWork, onUncaughtError)

Source from the content-addressed store, hash-verified

11587 }
11588
11589 function commitErrorLogging(finishedWork, onUncaughtError) {
11590 switch (finishedWork.tag) {
11591 case ClassComponent:
11592 {
11593 var ctor = finishedWork.type;
11594 var _instance4 = finishedWork.stateNode;
11595 var updateQueue = finishedWork.updateQueue;
11596 !(updateQueue !== null && updateQueue.capturedValues !== null) ? invariant(false, 'An error logging effect should not have been scheduled if no errors were captured. This error is likely caused by a bug in React. Please file an issue.') : void 0;
11597 var capturedErrors = updateQueue.capturedValues;
11598 updateQueue.capturedValues = null;
11599
11600 if (typeof ctor.getDerivedStateFromCatch !== 'function') {
11601 // To preserve the preexisting retry behavior of error boundaries,
11602 // we keep track of which ones already failed during this batch.
11603 // This gets reset before we yield back to the browser.
11604 // TODO: Warn in strict mode if getDerivedStateFromCatch is
11605 // not defined.
11606 markLegacyErrorBoundaryAsFailed(_instance4);
11607 }
11608
11609 _instance4.props = finishedWork.memoizedProps;
11610 _instance4.state = finishedWork.memoizedState;
11611 for (var i = 0; i < capturedErrors.length; i++) {
11612 var errorInfo = capturedErrors[i];
11613 var _error = errorInfo.value;
11614 var stack = errorInfo.stack;
11615 logError(finishedWork, errorInfo);
11616 _instance4.componentDidCatch(_error, {
11617 componentStack: stack !== null ? stack : ''
11618 });
11619 }
11620 }
11621 break;
11622 case HostRoot:
11623 {
11624 var _updateQueue2 = finishedWork.updateQueue;
11625 !(_updateQueue2 !== null && _updateQueue2.capturedValues !== null) ? invariant(false, 'An error logging effect should not have been scheduled if no errors were captured. This error is likely caused by a bug in React. Please file an issue.') : void 0;
11626 var _capturedErrors = _updateQueue2.capturedValues;
11627 _updateQueue2.capturedValues = null;
11628 for (var _i = 0; _i < _capturedErrors.length; _i++) {
11629 var _errorInfo = _capturedErrors[_i];
11630 logError(finishedWork, _errorInfo);
11631 onUncaughtError(_errorInfo.value);
11632 }
11633 break;
11634 }
11635 default:
11636 invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.');
11637 }
11638 }
11639
11640 function commitAttachRef(finishedWork) {
11641 var ref = finishedWork.ref;

Callers 1

commitAllLifeCyclesFunction · 0.70

Calls 4

invariantFunction · 0.70
logErrorFunction · 0.70
onUncaughtErrorFunction · 0.70

Tested by

no test coverage detected