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

Function logCapturedError

code/one-direction-data-flow/public/app.js:11001–11045  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

10999}
11000
11001function logCapturedError(capturedError) {
11002 var logError = showErrorDialog(capturedError);
11003
11004 // Allow injected showErrorDialog() to prevent default console.error logging.
11005 // This enables renderers like ReactNative to better manage redbox behavior.
11006 if (logError === false) {
11007 return;
11008 }
11009
11010 var error = capturedError.error;
11011 var suppressLogging = error && error.suppressReactErrorLogging;
11012 if (suppressLogging) {
11013 return;
11014 }
11015
11016 {
11017 var componentName = capturedError.componentName,
11018 componentStack = capturedError.componentStack,
11019 errorBoundaryName = capturedError.errorBoundaryName,
11020 errorBoundaryFound = capturedError.errorBoundaryFound,
11021 willRetry = capturedError.willRetry;
11022
11023
11024 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
11025
11026 var errorBoundaryMessage = void 0;
11027 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
11028 if (errorBoundaryFound && errorBoundaryName) {
11029 if (willRetry) {
11030 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
11031 } else {
11032 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
11033 }
11034 } else {
11035 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.';
11036 }
11037 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
11038
11039 // In development, we provide our own message with just the component stack.
11040 // We don't include the original error message and JS stack because the browser
11041 // has already printed it. Even if the application swallows the error, it is still
11042 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
11043 console.error(combinedMessage);
11044 }
11045}
11046
11047var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
11048var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected