honojs-middleware/deno_dist/index.ts

20 lines
465 B
TypeScript
Raw Normal View History

2022-08-04 07:54:30 +08:00
import type { Handler } from 'https://raw.githubusercontent.com/honojs/hono/v2.0.6/deno_dist/mod.ts'
2022-08-10 00:08:36 +08:00
import Toucan from 'toucan-js'
2022-08-04 07:54:30 +08:00
2022-08-10 00:08:36 +08:00
export const hello = (): Handler => {
2022-08-04 07:54:30 +08:00
return async (c, next) => {
2022-08-10 00:08:36 +08:00
const sentry = new Toucan({
dsn: c.env.SENTRY_DSN,
request: c.req,
allowedHeaders: ['user-agent'],
allowedSearchParams: /(.*)/,
})
try {
await next()
} catch (error) {
sentry.captureException(error)
}
2022-08-04 07:54:30 +08:00
}
}