(returnFiber, sourceFiber, rawValue)
| 11034 | |
| 11035 | |
| 11036 | function throwException(returnFiber, sourceFiber, rawValue) { |
| 11037 | // The source fiber did not complete. |
| 11038 | sourceFiber.effectTag |= Incomplete; |
| 11039 | // Its effect list is no longer valid. |
| 11040 | sourceFiber.firstEffect = sourceFiber.lastEffect = null; |
| 11041 | |
| 11042 | var value = createCapturedValue(rawValue, sourceFiber); |
| 11043 | |
| 11044 | var workInProgress = returnFiber; |
| 11045 | do { |
| 11046 | switch (workInProgress.tag) { |
| 11047 | case HostRoot: |
| 11048 | { |
| 11049 | // Uncaught error |
| 11050 | var errorInfo = value; |
| 11051 | ensureUpdateQueues(workInProgress); |
| 11052 | var updateQueue = workInProgress.updateQueue; |
| 11053 | updateQueue.capturedValues = [errorInfo]; |
| 11054 | workInProgress.effectTag |= ShouldCapture; |
| 11055 | return; |
| 11056 | } |
| 11057 | case ClassComponent: |
| 11058 | // Capture and retry |
| 11059 | var ctor = workInProgress.type; |
| 11060 | var _instance = workInProgress.stateNode; |
| 11061 | if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) { |
| 11062 | ensureUpdateQueues(workInProgress); |
| 11063 | var _updateQueue = workInProgress.updateQueue; |
| 11064 | var capturedValues = _updateQueue.capturedValues; |
| 11065 | if (capturedValues === null) { |
| 11066 | _updateQueue.capturedValues = [value]; |
| 11067 | } else { |
| 11068 | capturedValues.push(value); |
| 11069 | } |
| 11070 | workInProgress.effectTag |= ShouldCapture; |
| 11071 | return; |
| 11072 | } |
| 11073 | break; |
| 11074 | default: |
| 11075 | break; |
| 11076 | } |
| 11077 | workInProgress = workInProgress['return']; |
| 11078 | } while (workInProgress !== null); |
| 11079 | } |
| 11080 | |
| 11081 | function unwindWork(workInProgress) { |
| 11082 | switch (workInProgress.tag) { |
no test coverage detected