(returnFiber, sourceFiber, rawValue)
| 11092 | |
| 11093 | |
| 11094 | function throwException(returnFiber, sourceFiber, rawValue) { |
| 11095 | // The source fiber did not complete. |
| 11096 | sourceFiber.effectTag |= Incomplete; |
| 11097 | // Its effect list is no longer valid. |
| 11098 | sourceFiber.firstEffect = sourceFiber.lastEffect = null; |
| 11099 | |
| 11100 | var value = createCapturedValue(rawValue, sourceFiber); |
| 11101 | |
| 11102 | var workInProgress = returnFiber; |
| 11103 | do { |
| 11104 | switch (workInProgress.tag) { |
| 11105 | case HostRoot: |
| 11106 | { |
| 11107 | // Uncaught error |
| 11108 | var errorInfo = value; |
| 11109 | ensureUpdateQueues(workInProgress); |
| 11110 | var updateQueue = workInProgress.updateQueue; |
| 11111 | updateQueue.capturedValues = [errorInfo]; |
| 11112 | workInProgress.effectTag |= ShouldCapture; |
| 11113 | return; |
| 11114 | } |
| 11115 | case ClassComponent: |
| 11116 | // Capture and retry |
| 11117 | var ctor = workInProgress.type; |
| 11118 | var _instance = workInProgress.stateNode; |
| 11119 | if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) { |
| 11120 | ensureUpdateQueues(workInProgress); |
| 11121 | var _updateQueue = workInProgress.updateQueue; |
| 11122 | var capturedValues = _updateQueue.capturedValues; |
| 11123 | if (capturedValues === null) { |
| 11124 | _updateQueue.capturedValues = [value]; |
| 11125 | } else { |
| 11126 | capturedValues.push(value); |
| 11127 | } |
| 11128 | workInProgress.effectTag |= ShouldCapture; |
| 11129 | return; |
| 11130 | } |
| 11131 | break; |
| 11132 | default: |
| 11133 | break; |
| 11134 | } |
| 11135 | workInProgress = workInProgress['return']; |
| 11136 | } while (workInProgress !== null); |
| 11137 | } |
| 11138 | |
| 11139 | function unwindWork(workInProgress) { |
| 11140 | switch (workInProgress.tag) { |
no test coverage detected