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

Function logCapturedError

code/composition/public/app.js:11266–11310  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

11264}
11265
11266function logCapturedError(capturedError) {
11267 var logError = showErrorDialog(capturedError);
11268
11269 // Allow injected showErrorDialog() to prevent default console.error logging.
11270 // This enables renderers like ReactNative to better manage redbox behavior.
11271 if (logError === false) {
11272 return;
11273 }
11274
11275 var error = capturedError.error;
11276 var suppressLogging = error && error.suppressReactErrorLogging;
11277 if (suppressLogging) {
11278 return;
11279 }
11280
11281 {
11282 var componentName = capturedError.componentName,
11283 componentStack = capturedError.componentStack,
11284 errorBoundaryName = capturedError.errorBoundaryName,
11285 errorBoundaryFound = capturedError.errorBoundaryFound,
11286 willRetry = capturedError.willRetry;
11287
11288
11289 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
11290
11291 var errorBoundaryMessage = void 0;
11292 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
11293 if (errorBoundaryFound && errorBoundaryName) {
11294 if (willRetry) {
11295 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
11296 } else {
11297 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
11298 }
11299 } else {
11300 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.';
11301 }
11302 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
11303
11304 // In development, we provide our own message with just the component stack.
11305 // We don't include the original error message and JS stack because the browser
11306 // has already printed it. Even if the application swallows the error, it is still
11307 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
11308 console.error(combinedMessage);
11309 }
11310}
11311
11312var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
11313var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected