MCPcopy Create free account
hub / github.com/BetaSu/big-react / handleThrow

Function handleThrow

packages/react-reconciler/src/workLoop.ts:429–450  ·  view source on GitHub ↗
(root: FiberRootNode, thrownValue: any)

Source from the content-addressed store, hash-verified

427}
428
429function handleThrow(root: FiberRootNode, thrownValue: any): void {
430 /*
431 throw可能的情况
432 1. use thenable
433 2. error (Error Boundary处理)
434 */
435 if (thrownValue === SuspenseException) {
436 workInProgressSuspendedReason = SuspendedOnData;
437 thrownValue = getSuspenseThenable();
438 } else {
439 const isWakeable =
440 thrownValue !== null &&
441 typeof thrownValue === 'object' &&
442 typeof thrownValue.then === 'function';
443
444 workInProgressThrownValue = thrownValue;
445 workInProgressSuspendedReason = isWakeable
446 ? SuspendedOnDeprecatedThrowPromise
447 : SuspendedOnError;
448 }
449 workInProgressThrownValue = thrownValue;
450}
451
452function throwAndUnwindWorkLoop(
453 root: FiberRootNode,

Callers 1

renderRootFunction · 0.85

Calls 1

getSuspenseThenableFunction · 0.90

Tested by

no test coverage detected