(returnFiber, sourceFiber, rawValue)
| 10999 | |
| 11000 | |
| 11001 | function throwException(returnFiber, sourceFiber, rawValue) { |
| 11002 | // The source fiber did not complete. |
| 11003 | sourceFiber.effectTag |= Incomplete; |
| 11004 | // Its effect list is no longer valid. |
| 11005 | sourceFiber.firstEffect = sourceFiber.lastEffect = null; |
| 11006 | |
| 11007 | var value = createCapturedValue(rawValue, sourceFiber); |
| 11008 | |
| 11009 | var workInProgress = returnFiber; |
| 11010 | do { |
| 11011 | switch (workInProgress.tag) { |
| 11012 | case HostRoot: |
| 11013 | { |
| 11014 | // Uncaught error |
| 11015 | var errorInfo = value; |
| 11016 | ensureUpdateQueues(workInProgress); |
| 11017 | var updateQueue = workInProgress.updateQueue; |
| 11018 | updateQueue.capturedValues = [errorInfo]; |
| 11019 | workInProgress.effectTag |= ShouldCapture; |
| 11020 | return; |
| 11021 | } |
| 11022 | case ClassComponent: |
| 11023 | // Capture and retry |
| 11024 | var ctor = workInProgress.type; |
| 11025 | var _instance = workInProgress.stateNode; |
| 11026 | if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) { |
| 11027 | ensureUpdateQueues(workInProgress); |
| 11028 | var _updateQueue = workInProgress.updateQueue; |
| 11029 | var capturedValues = _updateQueue.capturedValues; |
| 11030 | if (capturedValues === null) { |
| 11031 | _updateQueue.capturedValues = [value]; |
| 11032 | } else { |
| 11033 | capturedValues.push(value); |
| 11034 | } |
| 11035 | workInProgress.effectTag |= ShouldCapture; |
| 11036 | return; |
| 11037 | } |
| 11038 | break; |
| 11039 | default: |
| 11040 | break; |
| 11041 | } |
| 11042 | workInProgress = workInProgress['return']; |
| 11043 | } while (workInProgress !== null); |
| 11044 | } |
| 11045 | |
| 11046 | function unwindWork(workInProgress) { |
| 11047 | switch (workInProgress.tag) { |
no test coverage detected