Skip to content

Commit

Permalink
添加sentry机制
Browse files Browse the repository at this point in the history
  • Loading branch information
dumingcode committed Mar 21, 2019
1 parent 191b2fe commit 9ddbbe1
Show file tree
Hide file tree
Showing 3 changed files with 5,228 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ const logger = require('koa-logger')

const routers = require('./routes/index')
const Router = require('koa-router')
const Sentry = require('@sentry/node')

// error handler
onerror(app)

Sentry.init({ dsn: 'https://c3c61980cbaf419990217ab42643fe12@sentry.io/1420239' })
// middlewares
app.use(bodyparser({
enableTypes: ['json', 'form', 'text']
Expand Down Expand Up @@ -41,6 +42,7 @@ app.use(routers.routes()).use(routers.allowedMethods())

// error-handling
app.on('error', (err, ctx) => {
Sentry.captureException(err)
console.error('server error', err, ctx)
});

Expand Down

0 comments on commit 9ddbbe1

Please sign in to comment.