(finishedWork, onUncaughtError)
| 10697 | } |
| 10698 | |
| 10699 | function commitErrorLogging(finishedWork, onUncaughtError) { |
| 10700 | switch (finishedWork.tag) { |
| 10701 | case ClassComponent: |
| 10702 | { |
| 10703 | var ctor = finishedWork.type; |
| 10704 | var _instance4 = finishedWork.stateNode; |
| 10705 | var updateQueue = finishedWork.updateQueue; |
| 10706 | !(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; |
| 10707 | var capturedErrors = updateQueue.capturedValues; |
| 10708 | updateQueue.capturedValues = null; |
| 10709 | |
| 10710 | if (typeof ctor.getDerivedStateFromCatch !== 'function') { |
| 10711 | // To preserve the preexisting retry behavior of error boundaries, |
| 10712 | // we keep track of which ones already failed during this batch. |
| 10713 | // This gets reset before we yield back to the browser. |
| 10714 | // TODO: Warn in strict mode if getDerivedStateFromCatch is |
| 10715 | // not defined. |
| 10716 | markLegacyErrorBoundaryAsFailed(_instance4); |
| 10717 | } |
| 10718 | |
| 10719 | _instance4.props = finishedWork.memoizedProps; |
| 10720 | _instance4.state = finishedWork.memoizedState; |
| 10721 | for (var i = 0; i < capturedErrors.length; i++) { |
| 10722 | var errorInfo = capturedErrors[i]; |
| 10723 | var _error = errorInfo.value; |
| 10724 | var stack = errorInfo.stack; |
| 10725 | logError(finishedWork, errorInfo); |
| 10726 | _instance4.componentDidCatch(_error, { |
| 10727 | componentStack: stack !== null ? stack : '' |
| 10728 | }); |
| 10729 | } |
| 10730 | } |
| 10731 | break; |
| 10732 | case HostRoot: |
| 10733 | { |
| 10734 | var _updateQueue2 = finishedWork.updateQueue; |
| 10735 | !(_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; |
| 10736 | var _capturedErrors = _updateQueue2.capturedValues; |
| 10737 | _updateQueue2.capturedValues = null; |
| 10738 | for (var _i = 0; _i < _capturedErrors.length; _i++) { |
| 10739 | var _errorInfo = _capturedErrors[_i]; |
| 10740 | logError(finishedWork, _errorInfo); |
| 10741 | onUncaughtError(_errorInfo.value); |
| 10742 | } |
| 10743 | break; |
| 10744 | } |
| 10745 | default: |
| 10746 | invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.'); |
| 10747 | } |
| 10748 | } |
| 10749 | |
| 10750 | function commitAttachRef(finishedWork) { |
| 10751 | var ref = finishedWork.ref; |
no test coverage detected