From d750ffa9635de29573703b26010dcb0470c7d0cf Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 21 Aug 2018 18:19:20 +0800 Subject: [PATCH] app: sentry track req --- middleware/onerror.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/middleware/onerror.js b/middleware/onerror.js index 9a89cdceb..a468383c3 100644 --- a/middleware/onerror.js +++ b/middleware/onerror.js @@ -18,9 +18,15 @@ module.exports = async (ctx, next) => { ctx.status = 404; if (config.sentry) { - Raven.captureException(err, function(err, eventId) { - console.log('Reported error ' + eventId); - }); + Raven.captureException( + err, + { + req: ctx.req, + }, + function(err, eventId) { + console.log('Reported error ' + eventId); + } + ); } } };