How to use the setContext function from raven
Find comprehensive JavaScript raven.setContext code examples handpicked from public code repositorys.
12 13 14 15 16 17 18 19 20 21 22 23
function raven_report(e, context_opts) { if(process.env.SENTRY_DSN) { Raven.context(function () { if(context_opts) { Raven.setContext(context_opts); }; Raven.captureException(e, (sendErr, event) => { if(sendErr) {
38
63
0
GitHub: athombv/node-homey-log
225 226 227 228 229 230 231 232 233 234 235 236
if (!context[key]) { context[key] = {}; } Object.assign(context[key], value); Raven.setContext(context); } }
5
3
0
+ 2 other calls in file
GitHub: liverecord/liverecord
246 247 248 249 250 251 252 253 254 255
socket.emit('user', webUser); socket.join('user:' + webUser._id); socket.webUser = webUser; // now have a user context and can work if (process.env.SENTRY_DSN) { Raven.setContext({user: webUser}); } // handlers comments(socket, io, antiSpam, webpush); question(socket, io, errorHandler);
2
9
0
52 53 54 55 56 57 58 59 60 61
// eslint-disable-next-line max-statements .use(async function attachUserToRequest(req, _res, next) { req.user = req.user || {} const token = req.headers['access-token'] const { id: userId } = jwtDecode(token, { secret }) raven.setContext({}) try { raven.mergeContext({ user: { id: userId }, tags: {
3
5
0
GitHub: izavits/node.analytics
58 59 60 61 62 63 64 65 66 67
* @param {Identify} identify */ Sentry.prototype.setContext = function (identify) { var traits = identify.traits(); if (!global.sentry) { SentryLib.setContext(traits); } else { global.sentry.setContext(traits); }
0
2
0
9 10 11 12 13 14 15 16 17 18 19 20
const nats = require('nats').connect(config.natsCfg); const hemera = new Hemera(nats, config.hemeraCfg); Raven.context(() => { Raven.setContext({ extra: { serviceName: 'user-service', }, });
2
0
0
58 59 60 61 62 63 64 65 66 67 68
}; if (req.user) { Object.assign(user, _.pick(req.user, 'id', 'username')); } Raven.setContext({ user }); } next(); }); };
0
0
0
GitHub: sensiblegame/AWS-lambda
31 32 33 34 35 36 37 38 39 40
invocationId, }, }); if (config.userId) { raven.setContext({ user: { id: config.userId, }, });
0
0
0
raven.captureException is the most popular function in raven (228 examples)