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

Function logCapturedError

code/new-context-api/public/app.js:10489–10533  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

10487}
10488
10489function logCapturedError(capturedError) {
10490 var logError = showErrorDialog(capturedError);
10491
10492 // Allow injected showErrorDialog() to prevent default console.error logging.
10493 // This enables renderers like ReactNative to better manage redbox behavior.
10494 if (logError === false) {
10495 return;
10496 }
10497
10498 var error = capturedError.error;
10499 var suppressLogging = error && error.suppressReactErrorLogging;
10500 if (suppressLogging) {
10501 return;
10502 }
10503
10504 {
10505 var componentName = capturedError.componentName,
10506 componentStack = capturedError.componentStack,
10507 errorBoundaryName = capturedError.errorBoundaryName,
10508 errorBoundaryFound = capturedError.errorBoundaryFound,
10509 willRetry = capturedError.willRetry;
10510
10511
10512 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
10513
10514 var errorBoundaryMessage = void 0;
10515 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
10516 if (errorBoundaryFound && errorBoundaryName) {
10517 if (willRetry) {
10518 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
10519 } else {
10520 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
10521 }
10522 } else {
10523 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.';
10524 }
10525 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
10526
10527 // In development, we provide our own message with just the component stack.
10528 // We don't include the original error message and JS stack because the browser
10529 // has already printed it. Even if the application swallows the error, it is still
10530 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
10531 console.error(combinedMessage);
10532 }
10533}
10534
10535var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
10536var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected