(finishedWork, onUncaughtError)
| 11330 | } |
| 11331 | |
| 11332 | function commitErrorLogging(finishedWork, onUncaughtError) { |
| 11333 | switch (finishedWork.tag) { |
| 11334 | case ClassComponent: |
| 11335 | { |
| 11336 | var ctor = finishedWork.type; |
| 11337 | var _instance4 = finishedWork.stateNode; |
| 11338 | var updateQueue = finishedWork.updateQueue; |
| 11339 | !(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; |
| 11340 | var capturedErrors = updateQueue.capturedValues; |
| 11341 | updateQueue.capturedValues = null; |
| 11342 | |
| 11343 | if (typeof ctor.getDerivedStateFromCatch !== 'function') { |
| 11344 | // To preserve the preexisting retry behavior of error boundaries, |
| 11345 | // we keep track of which ones already failed during this batch. |
| 11346 | // This gets reset before we yield back to the browser. |
| 11347 | // TODO: Warn in strict mode if getDerivedStateFromCatch is |
| 11348 | // not defined. |
| 11349 | markLegacyErrorBoundaryAsFailed(_instance4); |
| 11350 | } |
| 11351 | |
| 11352 | _instance4.props = finishedWork.memoizedProps; |
| 11353 | _instance4.state = finishedWork.memoizedState; |
| 11354 | for (var i = 0; i < capturedErrors.length; i++) { |
| 11355 | var errorInfo = capturedErrors[i]; |
| 11356 | var _error = errorInfo.value; |
| 11357 | var stack = errorInfo.stack; |
| 11358 | logError(finishedWork, errorInfo); |
| 11359 | _instance4.componentDidCatch(_error, { |
| 11360 | componentStack: stack !== null ? stack : '' |
| 11361 | }); |
| 11362 | } |
| 11363 | } |
| 11364 | break; |
| 11365 | case HostRoot: |
| 11366 | { |
| 11367 | var _updateQueue2 = finishedWork.updateQueue; |
| 11368 | !(_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; |
| 11369 | var _capturedErrors = _updateQueue2.capturedValues; |
| 11370 | _updateQueue2.capturedValues = null; |
| 11371 | for (var _i = 0; _i < _capturedErrors.length; _i++) { |
| 11372 | var _errorInfo = _capturedErrors[_i]; |
| 11373 | logError(finishedWork, _errorInfo); |
| 11374 | onUncaughtError(_errorInfo.value); |
| 11375 | } |
| 11376 | break; |
| 11377 | } |
| 11378 | default: |
| 11379 | invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.'); |
| 11380 | } |
| 11381 | } |
| 11382 | |
| 11383 | function commitAttachRef(finishedWork) { |
| 11384 | var ref = finishedWork.ref; |
no test coverage detected