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

Function logCapturedError

code/dependency-injection/public/app.js:11221–11265  ·  view source on GitHub ↗
(capturedError)

Source from the content-addressed store, hash-verified

11219}
11220
11221function logCapturedError(capturedError) {
11222 var logError = showErrorDialog(capturedError);
11223
11224 // Allow injected showErrorDialog() to prevent default console.error logging.
11225 // This enables renderers like ReactNative to better manage redbox behavior.
11226 if (logError === false) {
11227 return;
11228 }
11229
11230 var error = capturedError.error;
11231 var suppressLogging = error && error.suppressReactErrorLogging;
11232 if (suppressLogging) {
11233 return;
11234 }
11235
11236 {
11237 var componentName = capturedError.componentName,
11238 componentStack = capturedError.componentStack,
11239 errorBoundaryName = capturedError.errorBoundaryName,
11240 errorBoundaryFound = capturedError.errorBoundaryFound,
11241 willRetry = capturedError.willRetry;
11242
11243
11244 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
11245
11246 var errorBoundaryMessage = void 0;
11247 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
11248 if (errorBoundaryFound && errorBoundaryName) {
11249 if (willRetry) {
11250 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
11251 } else {
11252 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
11253 }
11254 } else {
11255 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.';
11256 }
11257 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
11258
11259 // In development, we provide our own message with just the component stack.
11260 // We don't include the original error message and JS stack because the browser
11261 // has already printed it. Even if the application swallows the error, it is still
11262 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
11263 console.error(combinedMessage);
11264 }
11265}
11266
11267var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
11268var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;

Callers 1

logErrorFunction · 0.70

Calls 1

showErrorDialogFunction · 0.70

Tested by

no test coverage detected