(finishedWork, onUncaughtError)
| 11209 | } |
| 11210 | |
| 11211 | function commitErrorLogging(finishedWork, onUncaughtError) { |
| 11212 | switch (finishedWork.tag) { |
| 11213 | case ClassComponent: |
| 11214 | { |
| 11215 | var ctor = finishedWork.type; |
| 11216 | var _instance4 = finishedWork.stateNode; |
| 11217 | var updateQueue = finishedWork.updateQueue; |
| 11218 | !(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; |
| 11219 | var capturedErrors = updateQueue.capturedValues; |
| 11220 | updateQueue.capturedValues = null; |
| 11221 | |
| 11222 | if (typeof ctor.getDerivedStateFromCatch !== 'function') { |
| 11223 | // To preserve the preexisting retry behavior of error boundaries, |
| 11224 | // we keep track of which ones already failed during this batch. |
| 11225 | // This gets reset before we yield back to the browser. |
| 11226 | // TODO: Warn in strict mode if getDerivedStateFromCatch is |
| 11227 | // not defined. |
| 11228 | markLegacyErrorBoundaryAsFailed(_instance4); |
| 11229 | } |
| 11230 | |
| 11231 | _instance4.props = finishedWork.memoizedProps; |
| 11232 | _instance4.state = finishedWork.memoizedState; |
| 11233 | for (var i = 0; i < capturedErrors.length; i++) { |
| 11234 | var errorInfo = capturedErrors[i]; |
| 11235 | var _error = errorInfo.value; |
| 11236 | var stack = errorInfo.stack; |
| 11237 | logError(finishedWork, errorInfo); |
| 11238 | _instance4.componentDidCatch(_error, { |
| 11239 | componentStack: stack !== null ? stack : '' |
| 11240 | }); |
| 11241 | } |
| 11242 | } |
| 11243 | break; |
| 11244 | case HostRoot: |
| 11245 | { |
| 11246 | var _updateQueue2 = finishedWork.updateQueue; |
| 11247 | !(_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; |
| 11248 | var _capturedErrors = _updateQueue2.capturedValues; |
| 11249 | _updateQueue2.capturedValues = null; |
| 11250 | for (var _i = 0; _i < _capturedErrors.length; _i++) { |
| 11251 | var _errorInfo = _capturedErrors[_i]; |
| 11252 | logError(finishedWork, _errorInfo); |
| 11253 | onUncaughtError(_errorInfo.value); |
| 11254 | } |
| 11255 | break; |
| 11256 | } |
| 11257 | default: |
| 11258 | invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.'); |
| 11259 | } |
| 11260 | } |
| 11261 | |
| 11262 | function commitAttachRef(finishedWork) { |
| 11263 | var ref = finishedWork.ref; |
no test coverage detected