Add request context to sentry exceptions
This commit is contained in:
parent
20fcbe40ac
commit
2fab9866f7
1 changed files with 6 additions and 3 deletions
9
app.js
9
app.js
|
@ -66,11 +66,14 @@ app.use(web.prefix('').routes());
|
||||||
app.ws.use(redis.middleware());
|
app.ws.use(redis.middleware());
|
||||||
app.ws.use(ws.prefix('/api').routes());
|
app.ws.use(ws.prefix('/api').routes());
|
||||||
|
|
||||||
app.on('error', (err) => {
|
app.on('error', (err, ctx) => {
|
||||||
if (err.statusCode === 404) return;
|
if (err.statusCode === 404) return;
|
||||||
if (process.env.SENTRY_DSN) {
|
if (process.env.SENTRY_DSN) {
|
||||||
Sentry.captureException(err, (_err, eventId) => {
|
Sentry.withScope(function(scope) {
|
||||||
debug('Reported error', eventId);
|
scope.addEventProcessor(function(event) {
|
||||||
|
return Sentry.Handlers.parseRequest(event, ctx.request);
|
||||||
|
});
|
||||||
|
Sentry.captureException(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue