(finishedWork, onUncaughtError)
| 10569 | } |
| 10570 | |
| 10571 | function commitErrorLogging(finishedWork, onUncaughtError) { |
| 10572 | switch (finishedWork.tag) { |
| 10573 | case ClassComponent: |
| 10574 | { |
| 10575 | var ctor = finishedWork.type; |
| 10576 | var _instance4 = finishedWork.stateNode; |
| 10577 | var updateQueue = finishedWork.updateQueue; |
| 10578 | !(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; |
| 10579 | var capturedErrors = updateQueue.capturedValues; |
| 10580 | updateQueue.capturedValues = null; |
| 10581 | |
| 10582 | if (typeof ctor.getDerivedStateFromCatch !== 'function') { |
| 10583 | // To preserve the preexisting retry behavior of error boundaries, |
| 10584 | // we keep track of which ones already failed during this batch. |
| 10585 | // This gets reset before we yield back to the browser. |
| 10586 | // TODO: Warn in strict mode if getDerivedStateFromCatch is |
| 10587 | // not defined. |
| 10588 | markLegacyErrorBoundaryAsFailed(_instance4); |
| 10589 | } |
| 10590 | |
| 10591 | _instance4.props = finishedWork.memoizedProps; |
| 10592 | _instance4.state = finishedWork.memoizedState; |
| 10593 | for (var i = 0; i < capturedErrors.length; i++) { |
| 10594 | var errorInfo = capturedErrors[i]; |
| 10595 | var _error = errorInfo.value; |
| 10596 | var stack = errorInfo.stack; |
| 10597 | logError(finishedWork, errorInfo); |
| 10598 | _instance4.componentDidCatch(_error, { |
| 10599 | componentStack: stack !== null ? stack : '' |
| 10600 | }); |
| 10601 | } |
| 10602 | } |
| 10603 | break; |
| 10604 | case HostRoot: |
| 10605 | { |
| 10606 | var _updateQueue2 = finishedWork.updateQueue; |
| 10607 | !(_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; |
| 10608 | var _capturedErrors = _updateQueue2.capturedValues; |
| 10609 | _updateQueue2.capturedValues = null; |
| 10610 | for (var _i = 0; _i < _capturedErrors.length; _i++) { |
| 10611 | var _errorInfo = _capturedErrors[_i]; |
| 10612 | logError(finishedWork, _errorInfo); |
| 10613 | onUncaughtError(_errorInfo.value); |
| 10614 | } |
| 10615 | break; |
| 10616 | } |
| 10617 | default: |
| 10618 | invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.'); |
| 10619 | } |
| 10620 | } |
| 10621 | |
| 10622 | function commitAttachRef(finishedWork) { |
| 10623 | var ref = finishedWork.ref; |
no test coverage detected