Skip to content

Confusing stack traces for exceptions in render #4910

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

Closed
yepitschunked opened this issue Sep 18, 2015 · 2 comments
Closed

Confusing stack traces for exceptions in render #4910

yepitschunked opened this issue Sep 18, 2015 · 2 comments

Comments

@yepitschunked
Copy link

I put a throw inside of a render function, and got this stacktrace:

Error caught: TypeError: Cannot read property '_currentElement' of null
    at ReactCompositeComponentMixin._updateRenderedComponent (https://localhost/vendor.js:19381:53)
    at ReactCompositeComponentMixin._performComponentUpdate (https://localhost/vendor.js:19363:11)
    at ReactCompositeComponentMixin.updateComponent (https://localhost/vendor.js:19279:13)
    at ReactPerf.measure.wrapper [as updateComponent] (https://localhost/vendor.js:11015:22)
    at ReactCompositeComponentMixin.receiveComponent (https://localhost/vendor.js:19143:11)
    at Object.ReactReconciler.receiveComponent (https://localhost/vendor.js:11151:23)
   ...

None of this is code I wrote, and none of this points to the component that failed. I'm using ES6 classes instead of React.createClass, which may or may not be relevant.

@syranide
Copy link
Contributor

MyClass.render not showing up in the stracktrace is very weird, but ultimately not something React does or even can manipulate. AFAIK the error is not re-thrown either (which sometimes messes up stack traces). Everything below that will only ever be internals really and uninteresting from a debugging perspective.

Which browser is this? Also, when all else fails, enable "pause on exception" in your browser and it usually points you to the problem even if the stack trace doesn't.

@sophiebits
Copy link
Collaborator

This is not the error you threw, but it is a second error that gets thrown later because React (currently) doesn't gracefully handle thrown errors (#2461).

As for why you're not seeing the first error, something else is catching the error – probably promises are getting you. See http://blog.taylormcgann.com/2014/08/21/catch-errors-javascript-promise-chains/. (dupe of #2912 and several others)

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

3 participants