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

Function logCapturedError

code/styling/public/app.js:11128–11172  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

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

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected