koa-raven
v3.1.1
Published
raven middleware for koa@2.
Downloads
21
Readme
NOTICE
Sentry now provides official Koa integration: https://sentry.io/for/koa/.
koa-raven
raven middleware for koa.
Install
$ npm i koa-raven --save
Usage
raven(DSN[, opts])
const raven = require('koa-raven')
const Koa = require('koa')
const app = new Koa()
app.use(raven('DSN', opts))
app.use((ctx) => {
throw new Error('test')
})
app.listen(3000)
or:
const raven = require('koa-raven')
const Koa = require('koa')
const app = new Koa()
app.use(raven('DSN', opts))
app.use((ctx) => {
try {
throw new Error('test')
} catch (e) {
ctx.raven.captureException(e, { extra: { name: 'tom' } })
ctx.status = 500
ctx.body = e.stack
}
})
app.listen(3000)
Options
see: https://docs.sentry.io/clients/node/config/.
License
MIT