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

Function logCapturedError

code/communication/public/app.js:11163–11207  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

11161}
11162
11163function logCapturedError(capturedError) {
11164 var logError = showErrorDialog(capturedError);
11165
11166 // Allow injected showErrorDialog() to prevent default console.error logging.
11167 // This enables renderers like ReactNative to better manage redbox behavior.
11168 if (logError === false) {
11169 return;
11170 }
11171
11172 var error = capturedError.error;
11173 var suppressLogging = error && error.suppressReactErrorLogging;
11174 if (suppressLogging) {
11175 return;
11176 }
11177
11178 {
11179 var componentName = capturedError.componentName,
11180 componentStack = capturedError.componentStack,
11181 errorBoundaryName = capturedError.errorBoundaryName,
11182 errorBoundaryFound = capturedError.errorBoundaryFound,
11183 willRetry = capturedError.willRetry;
11184
11185
11186 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
11187
11188 var errorBoundaryMessage = void 0;
11189 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
11190 if (errorBoundaryFound && errorBoundaryName) {
11191 if (willRetry) {
11192 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
11193 } else {
11194 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
11195 }
11196 } else {
11197 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.';
11198 }
11199 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
11200
11201 // In development, we provide our own message with just the component stack.
11202 // We don't include the original error message and JS stack because the browser
11203 // has already printed it. Even if the application swallows the error, it is still
11204 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
11205 console.error(combinedMessage);
11206 }
11207}
11208
11209var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
11210var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected