-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Send tags with captureException #75
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
Comments
I'll take a look at this today. |
@jmagnusson I just tested this and all appears well. Are you using the latest version of raven? And if so, what browser? |
Hopefully it's on my end. I have Other info: This is what the Raven-related code looks like: require(['startup'], function() {
require([
'cs!app/state',
'app/config',
'raven'
], function(
appstate,
appConf,
Raven
) {
var host = window.location.host,
ravenOpts = {tags: {host: host}};
// Initialize the error handler
Raven.config(appConf.sentryDSN).install();
try {
appstate();
}
catch (exc) {
// TODO: Why doesn't tags appear in Sentry?
// TODO #2: Maybe alert user that an error has occurred
Raven.captureException(exc, ravenOpts);
throw exc;
}
});
}); |
I've also tried the latest master ( I should also add that |
Removing Passing my ravenOpts directly to |
Are you trying to run from git directly, by any chance? Just including the src/raven.js is probably not the best idea. Either way, could you intercept the makeRequest() function and see the data that's being sent? |
I first tried the tagged 1.0.5 version found here, then also tried the requirejs.config({
paths: {
jquery: 'ext/jquery',
tracekit: 'ext/tracekit', // Error reporting
raven: 'ext/raven', // Error reporting
},
shim: {
jquery: {exports: 'jQuery'},
tracekit: {exports: 'TraceKit', deps: ['jquery']},
raven: {exports: 'Raven', deps: ['tracekit']},
}
}) Both "flavors" had the same problems which I mentioned previously. Here's the data being sent with makeRequest: URL (same for all tested browsers): Gist with sentry_data for the different browsers can be found here Our require(['startup'], function() {
require([
'cs!our/app/state',
'our/app/config',
'raven',
'underscore.string'
], function(
appstate,
appConf,
Raven,
_s
) {
var host = window.location.host,
ravenOpts = {tags: {host: host}};
// Initialize the error handler
// Raven.install adds a global error handler to window.onerror
Raven.config(appConf.sentryDSN, ravenOpts).install();
throw Error('Testing captureException with raven-js');
appstate();
});
}); |
First of all, thanks a ton for the information! :) Now, just to clarify, you've posted two different ways of tacking on the extra data. First, you showed it being added directly to captureException(), then second, you showed it added to the config() call. I'm guessing that they're both working incorrectly? |
And thanks for making this awesome script! :-) Actually I noticed that the catch-statement was never reached. It seems that the global window.onerror handler added by Raven.install re-raised the exception and script execution stopped after that. Maybe I could create a simple test so that it can be replicated. |
Well, technically, an error that is cause, is supposed to be reraised. That is by design. Raven's job isn't supposed to intercept all of your errors and make them go away. Raven is just a middleware, if you will, that logs it. Typically, on an uncaught exception, you want the error to bubble up to the user and break because unexpected things can happen if your code keeps executing. So as a developer, it's your job to still catch your own errors and handle things appropriately. |
Hello var options = { |
This should all be working just fine. Open a new ticket if it's broken in 1.1. |
I looked for a way to specify unchanging tags (such as git commit hash of my software), and mistakenly decided it wasn't possible to pass them to Raven.config() because the documentation enumerated various possible options but didn't mention `tags`. Bugs like getsentry#75 convinced me that this was supposed to be a supported feature. So here's a doc patch to avoid sending other users into confusion.
I haven't been able to send tags with
captureException
, but it is possible withcaptureMessage
. Example:The text was updated successfully, but these errors were encountered: