@samitouri / QOS-React / commits / 6c6ff8c4b6

Better messaging for componentDidCatch cross-origin errors (#10447)

The prior message was a bit wordy and didn't cover all cases (like the one we discovered while researching #10441). We can use the new URL to explain background info on the DEV-mode technique we're using in addition to common fixes (eg crossorigin attribute for CDN scripts and Webpack devtools settings). Putting this information behind a link will allow us to more easily edit it in the future as common causes for this issue change. Resolves #10441

Brian Vaughn committed Aug 14, 2017 at 11:05 UTC 6c6ff8c4b6a691c6be05ca9da5eb8660bc245044
1 file changed +2 -8
src/renderers/shared/utils/ReactErrorUtils.js
+2 -8
@@ -247,14 +247,8 @@ if (__DEV__) {
247 } else if (isCrossOriginError) {
248 error = new Error(
249 "A cross-origin error was thrown. React doesn't have access to " +
250 - 'the actual error because it catches errors using a global ' +
251 - 'error handler, in order to preserve the "Pause on exceptions" ' +
252 - 'behavior of the DevTools. This is only an issue in DEV-mode; ' +
253 - 'in production, React uses a normal try-catch statement.\n\n' +
254 - 'If you are using React from a CDN, ensure that the <script> tag ' +
255 - 'has a `crossorigin` attribute, and that it is served with the ' +
256 - '`Access-Control-Allow-Origin: *` HTTP header. ' +
257 - 'See https://fb.me/react-cdn-crossorigin',
250 + 'the actual error object in development. ' +
251 + 'See https://fb.me/react-crossorigin-error for more information.',
252 );
253 }
254 ReactErrorUtils._hasCaughtError = true;