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

don't remove anonymous functions from stack trace #290

Merged
merged 1 commit into from
Nov 14, 2014

Conversation

mwcz
Copy link
Contributor

@mwcz mwcz commented Nov 13, 2014

TraceKit's stacktrace regex for Chrome didn't match anonymous functions, so all anonymous functions in the stacktrace were being removed before reporting to Sentry. This caused errors to be attributed to the wrong files, and was generally extremely confusing. This change updates the regex to not require a function name be present in the stacktrace.

see #289

}());
}());
} catch(ex) {
trace = TraceKit.computeStackTrace(ex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this test will be brittle since it's tied specifically to how it's handled by Chrome. Could we mock an exception object instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote it that way because I assumed it'd be run from the command line only, through v8, so it would act just like Chrome. But that might be a bad assumption! I don't know Mocha very well. I'm guessing from your comment that the tests can be run in-browser too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically they can be, but they don't pass for all browsers yet. That's an ideal goal though, so I'd rather not back in more platform specific things than we need to. :)

@mattrobenolt
Copy link
Contributor

fwiw, the patch itself is fine. Just not a fan of the test since it'll be brittle. Ideally at some point, I'd like to do actual browser testing and let the test suite run in FF, IE, etc. This will be problematic.

I'd rather test over a fixture with a hardcoded stack trace as a string.

@mwcz
Copy link
Contributor Author

mwcz commented Nov 13, 2014

Sure thing, I can make that happen.

@mwcz
Copy link
Contributor Author

mwcz commented Nov 13, 2014

Hey, do you want a second commit on this PR, or a fresh PR with the two commits squashed?

@mattrobenolt
Copy link
Contributor

If you're comfortable with a: $ git commit -a --amend; git push -f, I'd personally prefer that. But it's not a big deal.

TraceKit's stacktrace regex for Chrome didn't match anonymous functions,
so all anonymous functions in the stacktrace were being removed before
reporting to Sentry.  This caused errors to be attributed to the wrong
files, and was generally extremely confusing.  This change updates the
regex to not *require* a function name be present in the stacktrace.
@mwcz mwcz force-pushed the fix-chrome-stacktrace-regex branch from a64e907 to d94cb5f Compare November 13, 2014 21:33
@mwcz
Copy link
Contributor Author

mwcz commented Nov 13, 2014

Sure thing, I don't care about the historical integrity of that branch. :) See if this test is more to your liking.

@mattrobenolt
Copy link
Contributor

Boom, I like this much better. :)

Now there's no excuse for other stack trace manipulations to not write tests!

Thanks! 🍰 ✨

@mwcz
Copy link
Contributor Author

mwcz commented Nov 13, 2014

Cake AND sparkles?! Dang! Raven contributions get the best emojis.

mattrobenolt added a commit that referenced this pull request Nov 14, 2014
don't remove anonymous functions from stack trace
@mattrobenolt mattrobenolt merged commit ee7fe10 into getsentry:master Nov 14, 2014
@mwcz mwcz deleted the fix-chrome-stacktrace-regex branch November 14, 2014 15:41
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

Successfully merging this pull request may close these issues.

2 participants