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

Function logCapturedError

code/third-party/public/app.js:10361–10405  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

10359}
10360
10361function logCapturedError(capturedError) {
10362 var logError = showErrorDialog(capturedError);
10363
10364 // Allow injected showErrorDialog() to prevent default console.error logging.
10365 // This enables renderers like ReactNative to better manage redbox behavior.
10366 if (logError === false) {
10367 return;
10368 }
10369
10370 var error = capturedError.error;
10371 var suppressLogging = error && error.suppressReactErrorLogging;
10372 if (suppressLogging) {
10373 return;
10374 }
10375
10376 {
10377 var componentName = capturedError.componentName,
10378 componentStack = capturedError.componentStack,
10379 errorBoundaryName = capturedError.errorBoundaryName,
10380 errorBoundaryFound = capturedError.errorBoundaryFound,
10381 willRetry = capturedError.willRetry;
10382
10383
10384 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
10385
10386 var errorBoundaryMessage = void 0;
10387 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
10388 if (errorBoundaryFound && errorBoundaryName) {
10389 if (willRetry) {
10390 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
10391 } else {
10392 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
10393 }
10394 } else {
10395 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.';
10396 }
10397 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
10398
10399 // In development, we provide our own message with just the component stack.
10400 // We don't include the original error message and JS stack because the browser
10401 // has already printed it. Even if the application swallows the error, it is still
10402 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
10403 console.error(combinedMessage);
10404 }
10405}
10406
10407var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
10408var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected