MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / logError

Function logError

code/controlled-uncontrolled/public/app.js:10503–10538  ·  view source on GitHub ↗
(boundary, errorInfo)

Source from the content-addressed store, hash-verified

10501
10502
10503function logError(boundary, errorInfo) {
10504 var source = errorInfo.source;
10505 var stack = errorInfo.stack;
10506 if (stack === null) {
10507 stack = getStackAddendumByWorkInProgressFiber(source);
10508 }
10509
10510 var capturedError = {
10511 componentName: source !== null ? getComponentName(source) : null,
10512 error: errorInfo.value,
10513 errorBoundary: boundary,
10514 componentStack: stack !== null ? stack : '',
10515 errorBoundaryName: null,
10516 errorBoundaryFound: false,
10517 willRetry: false
10518 };
10519
10520 if (boundary !== null) {
10521 capturedError.errorBoundaryName = getComponentName(boundary);
10522 capturedError.errorBoundaryFound = capturedError.willRetry = boundary.tag === ClassComponent;
10523 } else {
10524 capturedError.errorBoundaryName = null;
10525 capturedError.errorBoundaryFound = capturedError.willRetry = false;
10526 }
10527
10528 try {
10529 logCapturedError(capturedError);
10530 } catch (e) {
10531 // Prevent cycle if logCapturedError() throws.
10532 // A cycle may still occur if logCapturedError renders a component that throws.
10533 var suppressLogging = e && e.suppressReactErrorLogging;
10534 if (!suppressLogging) {
10535 console.error(e);
10536 }
10537 }
10538}
10539
10540var ReactFiberCommitWork = function (config, captureError, scheduleWork, computeExpirationForFiber, markLegacyErrorBoundaryAsFailed, recalculateCurrentTime) {
10541 var getPublicInstance = config.getPublicInstance,

Callers 1

commitErrorLoggingFunction · 0.70

Calls 3

getComponentNameFunction · 0.70
logCapturedErrorFunction · 0.70

Tested by

no test coverage detected