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

Function commitErrorLogging

code/event-handlers/public/app.js:10668–10717  ·  view source on GitHub ↗
(finishedWork, onUncaughtError)

Source from the content-addressed store, hash-verified

10666 }
10667
10668 function commitErrorLogging(finishedWork, onUncaughtError) {
10669 switch (finishedWork.tag) {
10670 case ClassComponent:
10671 {
10672 var ctor = finishedWork.type;
10673 var _instance4 = finishedWork.stateNode;
10674 var updateQueue = finishedWork.updateQueue;
10675 !(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;
10676 var capturedErrors = updateQueue.capturedValues;
10677 updateQueue.capturedValues = null;
10678
10679 if (typeof ctor.getDerivedStateFromCatch !== 'function') {
10680 // To preserve the preexisting retry behavior of error boundaries,
10681 // we keep track of which ones already failed during this batch.
10682 // This gets reset before we yield back to the browser.
10683 // TODO: Warn in strict mode if getDerivedStateFromCatch is
10684 // not defined.
10685 markLegacyErrorBoundaryAsFailed(_instance4);
10686 }
10687
10688 _instance4.props = finishedWork.memoizedProps;
10689 _instance4.state = finishedWork.memoizedState;
10690 for (var i = 0; i < capturedErrors.length; i++) {
10691 var errorInfo = capturedErrors[i];
10692 var _error = errorInfo.value;
10693 var stack = errorInfo.stack;
10694 logError(finishedWork, errorInfo);
10695 _instance4.componentDidCatch(_error, {
10696 componentStack: stack !== null ? stack : ''
10697 });
10698 }
10699 }
10700 break;
10701 case HostRoot:
10702 {
10703 var _updateQueue2 = finishedWork.updateQueue;
10704 !(_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;
10705 var _capturedErrors = _updateQueue2.capturedValues;
10706 _updateQueue2.capturedValues = null;
10707 for (var _i = 0; _i < _capturedErrors.length; _i++) {
10708 var _errorInfo = _capturedErrors[_i];
10709 logError(finishedWork, _errorInfo);
10710 onUncaughtError(_errorInfo.value);
10711 }
10712 break;
10713 }
10714 default:
10715 invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.');
10716 }
10717 }
10718
10719 function commitAttachRef(finishedWork) {
10720 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