| 19612 | } |
| 19613 | |
| 19614 | function logCapturedError(capturedError) { |
| 19615 | |
| 19616 | var error = capturedError.error; |
| 19617 | |
| 19618 | { |
| 19619 | var componentName = capturedError.componentName, |
| 19620 | componentStack = capturedError.componentStack, |
| 19621 | errorBoundaryName = capturedError.errorBoundaryName, |
| 19622 | errorBoundaryFound = capturedError.errorBoundaryFound, |
| 19623 | willRetry = capturedError.willRetry; // Browsers support silencing uncaught errors by calling |
| 19624 | // `preventDefault()` in window `error` handler. |
| 19625 | // We record this information as an expando on the error. |
| 19626 | |
| 19627 | if (error != null && error._suppressLogging) { |
| 19628 | if (errorBoundaryFound && willRetry) { |
| 19629 | // The error is recoverable and was silenced. |
| 19630 | // Ignore it and don't print the stack addendum. |
| 19631 | // This is handy for testing error boundaries without noise. |
| 19632 | return; |
| 19633 | } // The error is fatal. Since the silencing might have |
| 19634 | // been accidental, we'll surface it anyway. |
| 19635 | // However, the browser would have silenced the original error |
| 19636 | // so we'll print it first, and then print the stack addendum. |
| 19637 | |
| 19638 | |
| 19639 | console['error'](error); // Don't transform to our wrapper |
| 19640 | // For a more detailed description of this block, see: |
| 19641 | // https://github.com/facebook/react/pull/13384 |
| 19642 | } |
| 19643 | |
| 19644 | var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; |
| 19645 | var errorBoundaryMessage; // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. |
| 19646 | |
| 19647 | if (errorBoundaryFound && errorBoundaryName) { |
| 19648 | if (willRetry) { |
| 19649 | errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + "."); |
| 19650 | } else { |
| 19651 | errorBoundaryMessage = "This error was initially handled by the error boundary " + errorBoundaryName + ".\n" + "Recreating the tree from scratch failed so React will unmount the tree."; |
| 19652 | } |
| 19653 | } else { |
| 19654 | 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.'; |
| 19655 | } |
| 19656 | |
| 19657 | var combinedMessage = "" + componentNameMessage + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. |
| 19658 | // We don't include the original error message and JS stack because the browser |
| 19659 | // has already printed it. Even if the application swallows the error, it is still |
| 19660 | // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. |
| 19661 | |
| 19662 | console['error'](combinedMessage); // Don't transform to our wrapper |
| 19663 | } |
| 19664 | } |
| 19665 | |
| 19666 | var didWarnAboutUndefinedSnapshotBeforeUpdate = null; |
| 19667 | |