-
Notifications
You must be signed in to change notification settings - Fork 46.1k
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
Throwing components difficult to debug #4982
Comments
I managed to find the throwing component through the stacktrace + debug it with Chrome devtools. I'm not quite sure what things that can be done to make this easier to debug, I managed to get the component state/props when I enabled the Personally I would prefer that React doesn't do anything with the exceptions (Otherwise it might be even harder to find the source of the exception). |
Yes, but imagine you have 10 components that use |
FWIW if you're truly doing prop validation, this is what propTypes is for and that will automatically show the parent component name. |
+1 for rethinking exception handling. The normal debugging workflow is completely disrupted with the current behavior of swallowing and then re-throwing and/or logging exceptions. What if we just stopped |
React does not catch any exceptions. If your exceptions are being swallowed then it's something else in your toolchain (likely promises) doing it. |
I ran into a similar situation a couple of times: https://jsfiddle.net/gjf6u5of/2/
There is some component that throws for some reason. I got some weird prop and got upset. The stack trace, however, doesn't tell me anything. I doesn't even point me to
<Foo />
. They only non-react frames are the one with<Fooo />
(the outer-most component) and then with the throwing component.I would be great if a situation like this was easier to debug. In particular, seeing the state of the parent component would help a lot.
The text was updated successfully, but these errors were encountered: