Sentry-javascript: support Stack locals

Created on 5 Jul 2017  Â·  3Comments  Â·  Source: getsentry/sentry-javascript

Do you want to request a feature or report a bug?
feature
(If this is a usage question, please do not post it here—post it on forum.sentry.io instead. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)

What is the expected behavior?
According to the sentry docs,

In Python and PHP, Sentry will display the values of local variables at the time of each error.

Why don't we have this in js as well, and preferably also in react native? I think with the arguments variable we could log at least the locals of the function generating the exception, which would still be immensely useful.

Most helpful comment

Why don't we have this in js as well, and preferably also in react native? I think with the arguments variable we could log at least the locals of the function generating the exception, which would still be immensely useful.

Unfortunately this isn't possible today in browser JavaScript. The arguments object is lost by the time execution enters try/catch or the onerror global error handler.

We've long experimented with making this possible, but short of re-writing your code during a compilation step to expose every conceivable variable to Raven.js (e.g. using a babel plugin) – which would make all but trivial applications pretty much unusable – there's not much we can do.

All 3 comments

Why don't we have this in js as well, and preferably also in react native? I think with the arguments variable we could log at least the locals of the function generating the exception, which would still be immensely useful.

Unfortunately this isn't possible today in browser JavaScript. The arguments object is lost by the time execution enters try/catch or the onerror global error handler.

We've long experimented with making this possible, but short of re-writing your code during a compilation step to expose every conceivable variable to Raven.js (e.g. using a babel plugin) – which would make all but trivial applications pretty much unusable – there's not much we can do.

Unfortunately this isn't possible today in browser JavaScript. The arguments object is lost by the time execution enters try/catch or the onerror global error handler.

And what about Nodejs ? Would it be possible ?

And what about Nodejs ? Would it be possible ?

You're welcome to give it a shot – pull requests are accepted!

I've heard that it may be possible to run V8 in some kind of debugging/development mode that could expose local variables, if you wanted to start there.

Was this page helpful?
0 / 5 - 0 ratings