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

Function logCapturedError

code/redux/public/app.js:11379–11423  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

11377}
11378
11379function logCapturedError(capturedError) {
11380 var logError = showErrorDialog(capturedError);
11381
11382 // Allow injected showErrorDialog() to prevent default console.error logging.
11383 // This enables renderers like ReactNative to better manage redbox behavior.
11384 if (logError === false) {
11385 return;
11386 }
11387
11388 var error = capturedError.error;
11389 var suppressLogging = error && error.suppressReactErrorLogging;
11390 if (suppressLogging) {
11391 return;
11392 }
11393
11394 {
11395 var componentName = capturedError.componentName,
11396 componentStack = capturedError.componentStack,
11397 errorBoundaryName = capturedError.errorBoundaryName,
11398 errorBoundaryFound = capturedError.errorBoundaryFound,
11399 willRetry = capturedError.willRetry;
11400
11401
11402 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
11403
11404 var errorBoundaryMessage = void 0;
11405 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
11406 if (errorBoundaryFound && errorBoundaryName) {
11407 if (willRetry) {
11408 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
11409 } else {
11410 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
11411 }
11412 } else {
11413 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.';
11414 }
11415 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
11416
11417 // In development, we provide our own message with just the component stack.
11418 // We don't include the original error message and JS stack because the browser
11419 // has already printed it. Even if the application swallows the error, it is still
11420 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
11421 console.error(combinedMessage);
11422 }
11423}
11424
11425var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
11426var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected