MCPcopy Index your code
hub / github.com/microsoft/SandDance / logError

Function logError

docs/external/js/react-dom.development.js:19673–19709  ·  view source on GitHub ↗
(boundary, errorInfo)

Source from the content-addressed store, hash-verified

19671
19672 var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
19673 function logError(boundary, errorInfo) {
19674 var source = errorInfo.source;
19675 var stack = errorInfo.stack;
19676
19677 if (stack === null && source !== null) {
19678 stack = getStackByFiberInDevAndProd(source);
19679 }
19680
19681 var capturedError = {
19682 componentName: source !== null ? getComponentName(source.type) : null,
19683 componentStack: stack !== null ? stack : '',
19684 error: errorInfo.value,
19685 errorBoundary: null,
19686 errorBoundaryName: null,
19687 errorBoundaryFound: false,
19688 willRetry: false
19689 };
19690
19691 if (boundary !== null && boundary.tag === ClassComponent) {
19692 capturedError.errorBoundary = boundary.stateNode;
19693 capturedError.errorBoundaryName = getComponentName(boundary.type);
19694 capturedError.errorBoundaryFound = true;
19695 capturedError.willRetry = true;
19696 }
19697
19698 try {
19699 logCapturedError(capturedError);
19700 } catch (e) {
19701 // This method must not throw, or React internal state will get messed up.
19702 // If console.error is overridden, or logCapturedError() shows a dialog that throws,
19703 // we want to report this error outside of the normal stack as a last resort.
19704 // https://github.com/facebook/react/issues/13188
19705 setTimeout(function () {
19706 throw e;
19707 });
19708 }
19709 }
19710
19711 var callComponentWillUnmountWithTimer = function (current, instance) {
19712 startPhaseTimer(current, 'componentWillUnmount');

Callers 2

createRootErrorUpdateFunction · 0.85
createClassErrorUpdateFunction · 0.85

Calls 3

logCapturedErrorFunction · 0.85
getComponentNameFunction · 0.70

Tested by

no test coverage detected