Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught error thrown twice ? #11499

Closed
slim-hmidi opened this issue Nov 9, 2017 · 2 comments
Closed

Uncaught error thrown twice ? #11499

slim-hmidi opened this issue Nov 9, 2017 · 2 comments

Comments

@slim-hmidi
Copy link

I have the same problem mention on this issue: Unhandled error is displayed twice.
The error was :
cross_origin

Based on the @gaearon comment and #10474

For context, the reason it happens is because we intentionally let the browser interpret an error as uncaught before we rethrow.

I understand that is thrown by the browser (source file was searchAutocomplete.jsx) and the second thrown by the react (source file was react-dom.development.js).
Added to that :

If you follow the advice in the error and add an error boundary (which you should!), you will only see the error once. So that's not a huge problem in day-to-day workflow. In fact it nudges people to add error boundaries which is nice.

In this case there is no advice mentioned by the error, How can I get the error to be thrown once ?

@gaearon
Copy link
Collaborator

gaearon commented Nov 9, 2017

You should see a link to the error boundaries documentation next to the error. (Not directly in it, but most likely below.)

The link leads here: https://reactjs.org/docs/error-boundaries.html

That said I think the errors in event handlers would still be displayed twice. This is a little unfortunate but shouldn't prevent you from fixing them 🙂

@gaearon gaearon closed this as completed Nov 9, 2017
@slim-hmidi
Copy link
Author

@gaearon I'm trying to understand how the error will be thrown once if it is detected and in this case does it thrown only by react or by the browser. If we consider this error was shown once, does this thrown by react-dom.development.js or by the browser?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants