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

Function logCapturedError

code/controlled-uncontrolled/public/app.js:10452–10496  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

10450}
10451
10452function logCapturedError(capturedError) {
10453 var logError = showErrorDialog(capturedError);
10454
10455 // Allow injected showErrorDialog() to prevent default console.error logging.
10456 // This enables renderers like ReactNative to better manage redbox behavior.
10457 if (logError === false) {
10458 return;
10459 }
10460
10461 var error = capturedError.error;
10462 var suppressLogging = error && error.suppressReactErrorLogging;
10463 if (suppressLogging) {
10464 return;
10465 }
10466
10467 {
10468 var componentName = capturedError.componentName,
10469 componentStack = capturedError.componentStack,
10470 errorBoundaryName = capturedError.errorBoundaryName,
10471 errorBoundaryFound = capturedError.errorBoundaryFound,
10472 willRetry = capturedError.willRetry;
10473
10474
10475 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
10476
10477 var errorBoundaryMessage = void 0;
10478 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
10479 if (errorBoundaryFound && errorBoundaryName) {
10480 if (willRetry) {
10481 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
10482 } else {
10483 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
10484 }
10485 } else {
10486 errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
10487 }
10488 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
10489
10490 // In development, we provide our own message with just the component stack.
10491 // We don't include the original error message and JS stack because the browser
10492 // has already printed it. Even if the application swallows the error, it is still
10493 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
10494 console.error(combinedMessage);
10495 }
10496}
10497
10498var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
10499var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected