Skip to content

Commit 9020177

Browse files
committed
Better messaging for componentDidCatch cross-origin errors
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
1 parent 58e6ede commit 9020177

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/renderers/shared/utils/ReactErrorUtils.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,9 @@ if (__DEV__) {
246246
);
247247
} else if (isCrossOriginError) {
248248
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',
249+
"A cross-origin error was thrown so React doesn't have access to " +
250+
'the actual error object in development. ' +
251+
'See https://fb.me/react-crossorigin-error for more details.',
258252
);
259253
}
260254
ReactErrorUtils._hasCaughtError = true;

0 commit comments

Comments
 (0)