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

Function logCapturedError

code/higher-order-components/public/app.js:11122–11166  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

11120}
11121
11122function logCapturedError(capturedError) {
11123 var logError = showErrorDialog(capturedError);
11124
11125 // Allow injected showErrorDialog() to prevent default console.error logging.
11126 // This enables renderers like ReactNative to better manage redbox behavior.
11127 if (logError === false) {
11128 return;
11129 }
11130
11131 var error = capturedError.error;
11132 var suppressLogging = error && error.suppressReactErrorLogging;
11133 if (suppressLogging) {
11134 return;
11135 }
11136
11137 {
11138 var componentName = capturedError.componentName,
11139 componentStack = capturedError.componentStack,
11140 errorBoundaryName = capturedError.errorBoundaryName,
11141 errorBoundaryFound = capturedError.errorBoundaryFound,
11142 willRetry = capturedError.willRetry;
11143
11144
11145 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
11146
11147 var errorBoundaryMessage = void 0;
11148 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
11149 if (errorBoundaryFound && errorBoundaryName) {
11150 if (willRetry) {
11151 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
11152 } else {
11153 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
11154 }
11155 } else {
11156 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.';
11157 }
11158 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
11159
11160 // In development, we provide our own message with just the component stack.
11161 // We don't include the original error message and JS stack because the browser
11162 // has already printed it. Even if the application swallows the error, it is still
11163 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
11164 console.error(combinedMessage);
11165 }
11166}
11167
11168var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
11169var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected